Script for automatically updating Managed Oauth tokens in oauth_credential
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā06-07-2019 02:42 AM
Hello,
I am trying to automatize the refreshing of Oauth tokens that I use in the REST Messages, so I don't have to manually trigger it once the refresh token expires.
I know the Access and Refresh token is stored in the oauth_credential. Can someone help me find a script that checks if they expire and if they do generate a new one ?
Thank you !
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā06-11-2019 04:04 AM
One note would be that the my instance requests a token from another servicenow instance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā06-11-2019 04:18 AM
Apologies for the incorrect analysis. I created this on the impression that you are trying to generate token from a 3rd party url.
Forthe questions
1) regarding url: the mentioned one was I provided:https://instance/oauth2/token. I will come back to you regarding service now instance if I find anything.
2) on http header Authorization: Basic (encoded clientid:clientsecret) This way it will handle the basic authentication(client id and secret will be the credentials,authentication is client credentials type)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā06-11-2019 04:32 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā06-11-2019 10:25 PM
Hi,
Did it work?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā06-12-2019 02:34 AM
hello,
Unfortunately still not working, not sure what I am not doing properly, still getting the bad username password 401 error.