How to configure refresh token so that it does not expire
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2018 12:16 AM
Hi, I am setting up oauth on an instance, and have created a refresh token. The documentation says that the refresh token expires in 100 days by default, and I can change it on the console. However, I would like the token to never expire. Is there a way to do that (would setting a value of -1 do the trick?)
- Labels:
-
Instance Configuration
-
Integrations
- 5,251 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-12-2018 07:09 AM
Hi Karl,
I don't think system would allow so because of the OAuth functionality. It would have some life span.
Mark Correct if this solves your issue and also hit Like and 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
08-30-2018 07:08 AM
Hi Karl,
Any update on this?
Can you mark my answer as correct, helpful if you were able to achieve the requirement. This helps in removing this question from unanswered list and helps users to learn from your thread. Thanks in advance.
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
08-30-2018 07:15 AM
A refresh token has to be expired according to the physics of OAuth.
If you dont want a refresh token to be expired (which i dont think is a good idea).
Go to the table oauth_credential OR search for the Module Manage Tokens under System OAuth. Once you are in this table you should find a record related to your refresh token, in this record you can manipulate the Expires Field . You can probably put a Business Rule/Scheduled Job that keeps extending the value in the Expires field. This way your refresh token doesn't expire.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2018 07:55 AM
Is it possible to set expires in 3650 days (say 10 years) for a refresh token when generating the tokens?
Here I am using following python code to generate tokens
post_data = {
'grant_type': 'authorization_code',
'code': <code>,
'redirect_uri': '<redirect_url>',
'scope': 'useraccount'
# Any query parameter to set expiry date?
}
auth = base64.b64encode('<client_id>:<client_secret>')
headers = {'Authorization': 'Basic {}'.format(auth)}
resp = requests.post('https://instance.service-now.com/oauth_token.do', data=post_data, headers=headers)
In the post_data, are there any query parameter to set expiry date? or any other way to set expiry date are also welcomed except manually setting in application registry.