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 -
Token Service URL.
Public Content API URL.
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 :
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.