Does Servicenow auto generates access tokens after the first access token is manually generated

Shreyas Khade
Giga Guru

If the grant type is client credentials:

How does Servicenow manage to generate a new access token once the first access token that was manually generated got expired ? Does it automatically regenerate subsequent access tokens or is a script required to generate subsequent access tokens ?

 

If the grant type is auth code/ Resource Owner Credentials:

1. Does servicenow auto generates new access tokens after they get expired based on the valid refresh token ?

2. Do the refresh tokens need to be manually re-generated once it gets expired after a default 864000 seconds or it is auto-generated in Servicenow ?

 

 

1 ACCEPTED SOLUTION

Hi @Sandhya V , I tried implementing an integration via flow designer and what I observed was if at all a valid refresh token exists (for authorization code grant type), and the REST step contains a valid connection alias defined in the connection details section, everytime the flow gets triggered it will make servicenow look for an access token to successfully make a call, if it finds that the access token has expired it will auto-retrieve access token before making the REST call. But if the refresh token itself is expired then the first manual retrieval will again be needed. If the grant type is client credentials then after first manual retrieval of access token no need to further bother for the regeneration of access token again ever. Hence, for integrations configured via IntegrationHub flow designer there's no separate script required to fetch the tokens as opposed to the integrations configured via REST messages where a separate script shall be required to handle the auto generation of access tokens

View solution in original post

8 REPLIES 8

Maik Skoddow
Tera Patron
Tera Patron

Hi @Shreyas Khade 

if you are using REST messages and link these REST messages with the respective OAuth profile, ServiceNow will do everything for you in the background. That means, in case the access token is expired but the refresh token is not, a new access token is requested from the partner system automatically.

Maik

Hi @Maik Skoddow,

What if the integration is configured through a flow designer (integration Hub) will Servicenow still auto fetch access tokens ?

 

I am looking into this now as I built the integration in Flow designer and it is not refreshing the access token all the time. I have a valid refresh token right now, but no access token and the flow fails.

Make sure you have a connection alias added in the connection details sections of the REST step and are not using a connection inline option