How to get oAuth token automatically once it expires through script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2022 10:29 PM
Hi All,
I am trying to get the Oauth token from Zoho API. Below is the background script I used to get the Access token and refresh token but I need to get the authorisation code to proceed further.
How to get the authorization code:
var oAuthClient = new GlideOAuthClient();
var params = {
'grant_type': "authorization_code",
redirect_uri: '<instance_name>',
'scope': '<>',
'code': '<>'
};
var json = new JSON();
var text = json.encode(params);
var tokenResponse = oAuthClient.requestToken('<>', text);
gs.info("Error:" + tokenResponse.getErrorMessage());
var token = tokenResponse.getToken();
gs.log("AccessToken:" + token.getAccessToken());
gs.log("AccessTokenExpiresIn:" + token.getExpiresIn());
gs.log(" RefreshToken:" + token.getRefreshToken());
How to get the authorization code. and where to use the above script to get these codes continously. It's quite urgent seeking help from this.
Thanks,
Sid.
- Labels:
-
Integrations
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2022 11:12 AM
Hello Siddharth,
Please check below link
How to update Refresh token automatically once it expires in oauth2
How to generate the access token once it is expired from Business Rule?
Please Mark ✅ Correct/helpful, if applicable, Thanks!!
Regards
Sulabh Garg
Regards
Sulabh Garg