how the refresh token and access token renewed in manage tokens table in oauth2.0?

learn nv
Tera Contributor

Hi All,

could you please clarify my understanding on oauth2.0 tokens.

As per my understanding,

If refresh token expiry is 30 days, we should run a schedule job for new refresh token every 30 days. The newly generated refresh token will automatically updated in oauth_credential table. (No need to update this oauth_credential table with new refresh token using script).

similarly, If access token expires for every 30 minutes, we should run a job to generate new access token for every 30 mins using existing refresh token.The newly generated access token will automatically updated in oauth_credential table.(No need to update this oauth_credential table with new access token using script).

 

Question 2:

In my client instance I could is only access tokens for many of Oauth providers and only few providers has refresh token and access token both in oauth_credential table. Is it possible to have only access tokens?

 

Question 3:

Do we have any link/article to know the difference between grant types in oauth2.0?

 

Thank you,

Naveen

 

 

 

 

2 REPLIES 2

Maik Skoddow
Tera Patron
Tera Patron

Hi @learn nv 

basically, you don't have to take care of the management of refresh and access tokens, as ServiceNow is doing it in the background for you. 

The following articles will explain it again: 

And regarding your last question, please refer to https://docs.servicenow.com/bundle/vancouver-platform-security/page/administer/security/concept/c_OA... 

Thanks
Maik

Hi Maik,
I cannot access the first knowledge article you linked (KB1499198). I am having to regenerate the token every 30 minutes for a Salesforce spoke connection in Dev, but of course this is not a viable solution in Prod. I've seen some community responses say that you need to use a scheduled job that runs every 30 minutes to get the access token refreshed, but am curious if KB1499198 outlines something different.