OAuth Integration

Divya Rajasekar
Tera Contributor

Hi All,

I am facing issue while retrieving "AccessTokenExpiresIn  and RefreshToken" from Salesforce.
I am getting "Access Token" properly from Salesforce End but not able to get

1. AccessTokenExpiresIn --> getting value '0'

2. RefreshToken --> getting null value

3. Access Token --> getting Encrypted Access token.

i am able to to get all 3 values using "Get OAuth Token" UI Action which is running on Client Side. But i want to automate same with using Server Side code.

Below is my code and the Response :

Script : 

var oAuthClient = new sn_auth.GlideOAuthClient();
var params = {grant_type:"password", username:'username of salesforce admin', password:'password'};
var json = new global.JSON();
var text = json.encode(params);
var tokenResponse = oAuthClient.requestToken('Application registry name', text);
var token = tokenResponse.getToken();
gs.log("AccessToken:" + token.getAccessToken());
gs.log("AccessTokenExpiresIn:" + token.getExpiresIn());
gs.log(" RefreshToken:" + token.getRefreshToken());

Response:

DivyaRajasekar_1-1699888176663.png

 

 

Can anybody faced same issue while integrating salesforce to SNOW.

can someone help

0 REPLIES 0