inconsistency value for default value in OAuth V2 policy if variable Ref is null

Hi ,

I have put some custom attributes in developer and developer app.Using extract variable i am able to pick those variables and setting these variables in OAuth V2 accesstoken policy .below is sample line of code

<ExpiresIn ref="expireTime">900000</ExpiresIn>

Issue:

when i change custom Attribute names then it should pick default value which is 900000?but here its giving me weird outputs....its giving me previous values of custom attributes which i have set/which i have executed

Thanks

Salamat

0 7 275
7 REPLIES 7

Hi @Shaikh,

The behavior is, the policy tries to resolve the variable 'expireTime' during its execution.

Only if its not able to resolve 'expireTime' [meaning its null or or not set in the flow], then it will fallback to the concrete value of 900000,

So based on your description, it appears like you have a value for 'expiryTime' set somewhere in your flow before the Oauth policy gets executed.

When you changed your custom attributes, did you also update your ExtractVariables policy?

Run a trace and see if 'expiryTime' variable shows up in trace variables - during Oauth policy execution - that would give a clue on whats happening

Thanks,

Thanks Mukundha. after changing custom attribute i dint changed my Extract Variable policy , i dont need to change my Extract Variable policy as its able to pick custom variable properly. i changed my custom attribute value intentionally to pick concrete value 900000 as expire time .... my requirement is when there is no custom attribute/its null then it should pick concrete value 900000 ,which is not happening/picking .Hope you understand my query

Thanks

Salamat

yes,I think i got it- can you run a trace, download the trace session and send it?

i have attached 3 trace sessions.Here you will able to find three values 199,299,699. "access_token_lifetime"=300000 in developer app custom attribute, "access_token_lifetime"=200000 in developer custom attribute and default value in the ref tag=700000.<ExpiresIn ref="access_token_expiry_time">700000</ExpiresIn>.if i change any one of custom attribute name then its picking from another ,if i change both custom attribute name then some time its picking default value 700000,some time 300000 ,sometime 200000 whichever i hitted last .if i will do redeploy then it will work fine until again i would get same both custom attribute mismatch scenario . Thanks Salamat

					
				
			
			
				
			
			
				
			
			
			
			
			
			
		

Not applicable

I am seeing the same issue. Is there a resolution to this?

Not applicable

This is a bug. The workaround is to use a flow variable in javascript policy where you can initialize it with the request param or default value. Then refer that flow variable in the <ExpiresIn> element.

For example:

Javascript would look like

var expiration = context.getVariable('request.formparam.expires_in');
if(!(expiration && !isNaN(expiration))) {
    expiration ="5600000";
}
context.setVariable('expiresInFlow', expiration);

OuthV2 will have

<ExpiresIn ref="expiresInFlow">3600000</ExpiresIn>

Hopefully this is in the roadmap for a fix?