refresh_token_expires_in Doesn't populate.

So I have the ff. code to get the attributes of the Refresh Token I passed.

var token_details ={
"Data" : {
     "access_token" : context.getVariable("oauthv2refreshtoken.OA-ValidateRefreshToken.access_token"),
     "scope" : context.getVariable("oauthv2refreshtoken.OA-ValidateRefreshToken.scope"),
 "expires_in" : context.getVariable("oauthv2refreshtoken.OA-ValidateRefreshToken.expires_in"),
 "status" : context.getVariable("oauthv2refreshtoken.OA-ValidateRefreshToken.status"),
 "client_id" : context.getVariable("oauthv2refreshtoken.OA-ValidateRefreshToken.client_id"),
     "refresh_token" : context.getVariable("oauthv2refreshtoken.OA-ValidateRefreshToken.refresh_token"),
 "refresh_token_status" : context.getVariable("oauthv2refreshtoken.OA-ValidateRefreshToken.refresh_token_status"),
 "refresh_token_expires_in" : context.getVariable("oauthv2refreshtoken.OA-ValidateRefreshToken.refresh_token_expires_in "),
   "refresh_count" : context.getVariable("oauthv2refreshtoken.OA-ValidateRefreshToken.refresh_count"),
     "refresh_token_issued_at" : context.getVariable("oauthv2refreshtoken.OA-ValidateRefreshToken.refresh_token_issued_at"),
     "CurrentTime" : Date.now()
 },
 "Link" :   {
     "Self" : context.getVariable("proxy.basepath")
 },
 "Meta": {     }
};
context.setVariable("token_details",JSON.stringify(token_details));

Problem is the refresh_token_expires_in variable doesn't populate at all even though the Refresh Token has an expiry. What could be the reason why?

0 4 265
4 REPLIES 4

I don't know; can you give me an API Proxy that produces this condition? What is the grant type you are using?

Sorry for the late reply as I just noticed this now. But we are using Authorization Code grant Type. With regards to the proxy, it would prolly be of no use as its contains so many policies alright. But what I'm basically doing is that. I use OA-ValidateRefreshToken to validate if the Refresh Token is valid or not and use

oauthv2refreshtoken.OA-ValidateRefreshToken.refresh_token_expires_in 

to get the value of the refresh token expiry. Then I use Assign Message policy to get the contents of the token_details variable.

I wouldn't do that if I were you.

Why not just allow the policy to generate the response and just read the response.content variable? It's already JSON. It has all the details.

What you're doing seems over-complicated. There's a simpler, easier way.

It's just that I am also using this draft proxy for testing and cheatsheet of how I would get individual values associated in a variable in a token. It's not really for displaying all infos in the token. There might be instances of when we need to really retrieve a refresh tokens expiry another proxy using oauthv2refreshtoken.OA-ValidateRefreshToken.refresh_token_expires_in but not getting it, and through this draft proxy really, I could see and check whether if the token has that value or not at all and at the same time validate if the flow variable is working. Also, having the

<GenerateResponseenabled='true'/>
in the parameters, forces the policy with this parameter to be in the response flow of the proxy instead of where it is place originally like in the request flow. Or this could be overriden?.