Can not obtain an access token from a refresh token in ServiceNow through an application registry

Muhammad Mairaj
Tera Contributor

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

3 REPLIES 3

Anil Lande
Kilo Patron

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)

 

 

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

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.

Kit Cheong
Giga Guru

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.