Generating the access token with grant type as refresh_token

Mr A
Tera Contributor

Hi All,

 

Want to know, how can I generate the access token from ServiceNow with grant type as refresh_token.

This is for outbound REST call from ServiceNow to external APIs. Want to generate the access token using client id/secret and refresh token. And use that access token to make subsequent REST call.

This has example https://www.oauth.com/oauth2-servers/access-tokens/refreshing-access-tokens/

3 REPLIES 3

Ahmmed Ali
Mega Sage

Hello @Mr A 

 

You need to POST to below mentioned URL to get new access token using refresh token

 

https://INSTANCE_NAME.service-now.com/oauth_token.do?grant_type=refresh_token&refresh_token=YOUR_REF...

 

Note: replace values in CAPS with actual values

 

Thanks,

Ali

If I could help you with your Query then, please hit the Thumb Icon and mark my answer as Correct!!

Thank you,
Ali

Mr A
Tera Contributor

Thanks for your reply, this can be used when any external application want to get the token from servicenow instance.

Is there any option from ServiceNow, If I can make to other client to get the access token using any of the existing mechanism (if this can be done without any custom script, great. else happy for any custom options), and store in oauth credentials form so that can use in subsequent REST calls.

If you are connecting to other application from ServiceNow, you can simply configure the OAuth details in "Application Registry" under "System OAuth" application.

for details: https://docs.servicenow.com/bundle/utah-api-reference/page/administer/security/task/t_UseAThirdParty...

 

Once you configure the Application registry, ServiceNow by default manages access token as well we refresh tokens.

 

Here is one YouTube video explaining the same: https://www.youtube.com/watch?v=QRjjZ911bZE

If I could help you with your Query then, please hit the Thumb Icon and mark my answer as Correct!!

Thank you,
Ali
webservice #integration #integrationformula Web Services Integration Day 13 | OAUTH Token - Outbound Integration In this session, I will show you how can we Integrate using OAUTH Token with ServiceNow https://snowexpertrohit.com/child-document/servicenow-to-servicenow-integration/ Contact Us: ...