Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to make successful connection OAUTH2.0 with grant type client credentials in postman

vijayakumar kon
Tera Contributor

I am trying to get access token in postman with OATUH2.0 with grant type client credentials, but it fails. I have given correct client id and password.

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

@vijayakumar kon 

check my blog

OAuth 2.0 with Inbound REST 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Nilesh Pol
Kilo Sage
Kilo Sage

Hi @vijayakumar kon 

Common Issues and Troubleshooting:

  1. Invalid Token URL: Double-check that the token URL you’re using is correct. It should be provided by the API you are trying to access.

  2. Incorrect Client ID or Secret: Ensure that both the Client ID and Client Secret are correct. Even small typos can cause authentication failure.

  3. Scope Missing: Some APIs might require a scope, so if it's required, ensure you have added it correctly.

  4. Authorization Server Configuration: Sometimes, the issue may lie with the authorization server itself. Ensure the OAuth 2.0 server is correctly configured to support client credentials.

  5. Response Body/Error Message: Look at the response body for any error messages. For example, the response might contain:

    • invalid_client (if client ID or secret is wrong),
    • invalid_grant (if the grant type or credentials are incorrect),
    • invalid_scope (if a required scope is missing).
  6. Content-Type Header: In some cases, you may need to manually set the Content-Type header in the Headers tab to application/x-www-form-urlencoded.

 

AndersBGS
Tera Patron
Tera Patron

Hi @vijayakumar kon ,

 

I can recommend below articles, as this led me to set it up yesterday for the first time myself:

https://sapphirenow.dev/post/wdc-oauth-part-1/

https://sapphirenow.dev/post/oauth-part-2/

 

If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.

Best regards
Anders

Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/