Issue with refresh token

Rithvik
Tera Contributor

I used the below code, to generate access token with refresh token, from the below code I am getting access token but for refresh token I am getting "NULL" what is the reason for it? any idea?

 

username and passwords are correct only and also passed correct application registry

var oAuthClient = new GlideOAuthClient();
var params ={grant_type:"password", username:"itil", password:'itil'};
var json =new JSON();
var text = json.encode(params);
var tokenResponse = oAuthClient.requestToken('TestClient', text);
var token = tokenResponse.getToken();

gs.log("AccessToken:"+ token.getAccessToken());
gs.log("AccessTokenExpiresIn:"+ token.getExpiresIn());
gs.log(" RefreshToken:"+ token.getRefreshToken());
1 ACCEPTED SOLUTION

Raghu Ram Y
Kilo Sage

@Rithvik Check from the 3rd party whether it is IP restricted.

View solution in original post

14 REPLIES 14

Rithvik
Tera Contributor

In step 7, i am getting "NULL" value for refresh token

Have you followed exactly what I have mentioned in Step 6 .? 

Step 6 is driving Step 7 and is working correctly for multiple scenario I have tested.

Share your steps one after the other to assist you further

Regards,

Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Verified everything, in step 5 under variable substitution I can't see access token..remaining all are same.

Rithvik
Tera Contributor

Verified everything, in step 5 under variable substitution I can't see access token..remaining all are same.

Couple of things here you need to do :

1) In the Rest message under HTTP Request tab make sure you have the below configurations done as shown below:

find_real_file.png

Save it first and now if Variable Substitution is not present then create one exactly similar to shown in screenshot.

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

 

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke