Servicenow Oauth token API giving 401 access denied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2022 10:43 PM
I use this API <instance_name>.service-now.com/oauth_token.do with grant_type as refresh_token.
This API is used in order to refresh the access_token every time it expires.
I was of the opinion that if this API results in 401 Unauthorized access with body as
{
"error_description": "access_denied",
"error": "server_error"
}
that means that the refresh token has expired and user has to use this API with grant_type as password.
But recently I have found out that on making multiple calls to refresh the token some fail with this error, and next time the same call passes.
Can someone help me identify what could be the issue here? or in what case can I get 401 unauthorised and on next call I get 200 as response?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2024 12:14 PM
yes u can try using ur user id and pass under authentication
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2024 12:27 PM
I managed to solve this issue, it turns out that the "grant_type " contains a whitespace.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2024 12:55 PM
I am experiencing the same issue with no changes to the header values; it works sometimes and other times gives the "Access Denied" error