• Sayantan Basu

Access Tridion Public Content API while OAuth is enabled

First of all, I want to thanks everyone for liking my previous blogs on GraphQL queries. I have received a couple of comments and requests to write a blog on how to access Public Content API while Oauth is enabled. So planned to share that in this blog.

It is pretty simple using Postman tool as Postman has built-in OAuth-base authorization. Also, the Latest Postman tool provides an option to pass GraphQL(BETA Version) query along with the request.

As a prerequisite, you need below items handy -

  1. Token Service URL.

  2. Public Content API URL.

  3. Credentials for "cduser".

So here are the steps -

At first, you need to send a post request against token service. While sending the request you need to pass the "cduser" credentials in the Body section. This will return the access token as a response.

Now you have the access token in the response. You can copy the value in notepad and keep it ready for next request.

While coping make sure you keep the format like below - <token_type> <access_token> In this scenario it will be like :

Bearer client_id%3Dcduser%26Role%3Dcd%26FirstName%3DCD%26AllowedCookieForwarding%3Dtrue%26LastName%3DUser%26expiresOn%3D1567174569715%26digest%3DubbTR2wMzhnq_GjGfZ5LVvaPWeJE5-hYKAngcJBGNzc%3D

Then, you can send another request with an ‘Authorization’ header against Public Content API like below-

If you want to pass a GraphQL request, then go to Body Section and choose the GraphQL option there.

Pass the query under the Query Section and Send the request. This will provide you the result.

Hope you like this article! Please add your comments below if you would like to see more examples like this.

#TridionSites9 #PublicContentAPI #ContentDelivery #GraphQL #GraphiQL #Postman #Authentication #Oauth

187 views0 comments