OAuth Token from ServiceNow Not Working but Works in Postman
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi Everyone,
I’m working on an integration where we are required to use OAuth authentication. I’ve set up the OAuth profile in ServiceNow, but I’m running into an issue:
The token we get from ServiceNow’s OAuth setup is not working for the integration.
However, when I test the same OAuth flow in Postman, it works fine.
In Postman, I need to first fetch the token separately using username and password, and then use that token separately in the request header.
If I try to combine these steps directly, the integration doesn’t work.
In ServiceNow, we don’t have the option to explicitly provide the username/password in the OAuth profile the same way we do in Postman.
Has anyone faced a similar issue? If yes, how did you handle it in ServiceNow?
Any pointers or best practices for configuring OAuth authentication correctly in this type of scenario would be really helpful.
Thanks in advance!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
The reply on this post has some helpful troubleshooting tips. Are you seeing any errors?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi jaycee,
Thanks for thr response . And this is not the issue i am facing.
Regards,
Sai
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @snow57 ,
There might be a reason, scopes are not fully Configured, even if Postman successfully returns a token, missing or incorrect scopes on the ServiceNow OAuth record can cause failures when the token is requested through an outbound REST integration and If you're using the Authorization Code flow or another advanced grant type, setup must be precise...
Check this article from servicenow support: https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0779232
If you found my response helpful, please mark it as ‘Accept as Solution’ and ‘Helpful’. This helps other community members find the right answer more easily and supports the community.
Kaushal Kumar Jha - ServiceNow Consultant - Lets connect on Linkedin: https://www.linkedin.com/in/kaushalkrjha/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
that's the usual process
1) first get the token using oauth_token.do endpoint
2) use this token in header in the actual API call
You can't combine both the steps together as they need to be done separately only.
The Access token stays for 30mins and Refresh token stays for 100 days OOTB, unless somebody changed it.
Are you not able to get the access token from ServiceNow when you consume the endpoint from your 3rd party app?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader