Is there a way to update expiry time of an existing access token ?

There is a use case where in based on certain condition I need the access token to be alive for ‘x’ more minutes than its expiry time.Is there a way to do that ?

1 Like

@Naveen, have you taken a look http://apigee.com/docs/api-services/content/customizing-access-tokens#gettingandsettingcustomattributesatruntime ?

more info here ..

http://apigee.com/docs/api-services/reference/get-oauth-v2-info-policy

Seems like you should be able to use SetOauthv2Info policy for something like TTL, but you can’t.

Another alternative that is not elegant, but should get the job done:

  1. Track the access token where you want to change the TTL (e.g., save it to a variable).

  2. Invalidate the token.

<OAuthV2 name="InvalidateToken">   
      <Operation>InvalidateToken</Operation>
      <Tokens>
	<Token type="accesstoken" cascade="true">flow.variable</Token>
	<Token type="refreshtoken" cascade="true">flow.variable</Token>
    </Tokens>
</OAuthV2>

  1. Recreate the token using ExternalAccessToken policy with reference to the variable you saved in step 1. More info here.
1 Like

Also, there’s more on using ExternalAccessToken here: http://apigee.com/docs/api-services/content/use-third-party-oauth-system

1 Like