Scheduled job to automatically get new Oauth token/refresh token when old one expires
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2019 01:08 AM
Hello,
I currently have 2 ServiceNow Instances synced between each other using OAuth 2.
Currently, when the token expires I have to manually get a new one from the REST message.
I am trying to create a new Scheduled job to run just before the refresh token expires so I can create a new one automatically without any manual input.
Can someone advise how the scheduled job script will look so that it checks for an expiry date of the current token and then automatically requests and updates the new token?
Thank you!
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2019 02:45 AM
I am trying to not include the token request directly in the business rules
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2019 03:34 AM
Added comment in https://community.servicenow.com/community?id=community_question&sys_id=047c9ac3dbb97340feb1a851ca96..., please check if that helps