Access token in case of client credentials grant type Oauth?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2024 05:36 AM
Hi
i am trying to integrate outbound rest with third party and recieved client secret and ID
i tested Get token through outbound rest api created and i am able to check the message token successful
but it says will be expired in an hour
Question :
In case of client credentials grant type ,how can we handle token without expiring ? or get new access token if expired
i am using script in business rule to call the API
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2024 06:06 AM
Hey @Kiran Kumar 76
Try looking at these two links and see if they help. You'll probably have to script a scheduled job to refresh the token every 50 minutes.
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0791131
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2024 05:37 PM
Thanks @KevinBellardine
can you please help me here in understanding below script from link
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0791131
var requestor_context = 'test'; //what value goes in here
var requestor_id = 'abc@xyz.com';//what value goes in here
var params = {grant_type:"password", username:'admin', password:'pwd', oauth_requestor_context:requestor_context, oauth_requestor:requestor_id, oauth_provider_profile:oauth_profile_id}; //Please update in case of client credentials how this line needs to be modified
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2025 04:02 AM
Hey @Kiran Kumar 76 ,
Did you find any solution for getting access token automatically. I'm facing the same issue for Grant type Client Credentials. Help will be appreciated. Thanks