Sitecore Connect: Building Persistent Connections to XM Cloud using GraphQL Connector

Utilizing Workato, Sitecore Connect offers an impressive GraphQL connector, facilitating connections to XM Cloud temporarily until Sitecore releases a dedicated XM Cloud connector later this year. During my experience with the GraphQL connector, a common challenge emerged: building persistent connections proved difficult due to a known limitation within the connector.

Sitecore requires an audience parameter for authenticating GraphQL connections when using client credentials flow, a feature absent in the GraphQL connector. Consequently, I had to use the Header Authorization method and pass the bearer token which was generated using CMD/Postman. This token has to be updated every 24 hours upon expiration in the Sitecore Connect. An alternative was to manually edit the GraphQL connector by accessing Tools -> Connector SDK, given its community-editable nature.

However, a few weeks ago, the Workato team addressed this limitation by updating the GraphQL connector. They introduced a new field called ‘OAuth 2.0 audiences’, applicable to OAuth 2.0 authentication methods like client credentials and authorization code!

NOTE: If you don’t see this option(highlighted below), it’s possible you’re using an older connector version and need an upgrade. Please refer to my previous blog post for instructions on updating your GraphQL connector.

You will need to specify the below parameters to create this connection:

GraphQL endpoint:  This endpoint address follows the below format as we connect to XM Cloud’s GraphQL Authoring and Management API,
https://<your-instance>.sitecorecloud.io/sitecore/api/authoring/graphql/v1/
Authentication method: OAuth 2.0 (client credentials)
OAuth 2.0 token URL: https://auth.sitecorecloud.io/oauth/token
How does the API require credentials to be sent to request a token: Body
OAuth 2.0 audiences: https://api.sitecorecloud.io
OAuth 2.0 client ID & OAuth 2.0 client secret: You can create this from the Credentials section of the Deploy app as indicated below,

I hope you discovered this blog post to be helpful, saving you precious time in the process!

Leave a Reply

Your email address will not be published. Required fields are marked *