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 01:28 AM
Hi,
I don't think this is required. the code where you are actually making an API call just before that have a script to get the access token again and then use that.
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
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
‎06-07-2019 01:32 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
‎10-05-2021 02:32 AM
Hi
1. Can you tell exactly needs to be scripted?
2. For the first time to get access token, do we need to do it manually by clicking"get access token"?
Thanks,
Shraddha
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2021 02:43 AM
Can you post a new question for this and tag me there
This is quite older thread.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader