Can not obtain an access token from a refresh token in ServiceNow through an application registry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2023 02:16 AM - edited 10-30-2023 02:18 AM
Hi Community,
I am not able to get access token (Oauth 2.0) from third-party provider (Workday) through application registry, When I try to 'Get OAuth Token' from credentials record (oauth_2_0_credentials) returns below error.
HTTP Error 401 - Unauthorized
Not sure, I am getting it because bad/invalid auth url or due to configuration workday side. Additionally, When I try to get access token through refresh token I get result by scripting 'GlideOAuthClientRequest & GlideOAuthClient using requestToken method'.
Thanks in advance,
Muhammad

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2023 02:23 AM
Hi,
Make sure you have used correct URL's while configuring OAuth Provider.
Also check if you have entered additional blank space, (common error when we do copy paste)
Thanks
Anil Lande
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2023 02:35 AM
I have verified values such as client-id, client-secret, and token url in application registry. as I said I am able to get access token by 'GlideOAuthClientRequest & GlideOAuthClient' as well as in Postman but not through credential record Get OAuth Token.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2023 12:41 AM
If you're not getting the Workday login screen when clicking "Get OAuth Token", open the Application Registry [oauth_entity] record in ServiceNow, add this param' to the Authorisation URL: ?redirect=n
E.g. https://x.myworkday.com/[your tennant]/authorize?redirect=n
If none of this works try logging into workday on a new tab using the "API client" credentials, then click "Get OAuth Token" in the ServiceNow tab.