How to update Refresh token automatically once it expires in oauth2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2021 01:51 AM
I have an integration that uses Oauth2 as authorization which uses 2 tokens, Refresh and access token.
Access token are being taken care via code and updated automatically.
In case of refresh token there is no way to update it automatically.
I provided life time to 1 year for refresh token but the question is how to take care of it once it is about to expire.
Any suggestions to take care of it automatically?
- Labels:
-
Integrations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2021 08:31 PM
refresh token is used to regenerate new Access token when the older Access token expires.
If you are getting access token and refresh token in actual API call then no need to generate them again as before every actual API call you will get those and those will be the latest
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2021 08:55 PM
Hi,
When you generate the token, You also get the expired duration in response accordingly you can refresh the token in a scheduled job and hit the API from where you are getting token
In my case we are generating token every 55 Mins where we have scheduled job which running every 55 Mins before token expired
Please mark as correct/helpful, If you find any help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2021 01:40 AM
Hi,
Could you please share the script required in the scheduled job?