Announcements
This site is in read only until July 22 as we migrate to a new platform; refer to this community post for more details.
Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

How to set same ExpiresIn (ttl) in refresh token?

Not applicable

How to set same ExpiresIn time for both access token and refresh token? The ExpiresIn time in token generation (access token) flow is derived from back end service. I need to use same value for refresh token. I tried to set this time in custom attribute, however these custom attributes are available only after generation of refresh token. The GetOAuthV2Info policy is not returning custom attributes.

Solved Solved
0 7 488
1 ACCEPTED SOLUTION

Not applicable

Thanks. This is resolved. I am able to extract custom attributes in GetOAuthV2Info. Here are the policies -

Generate token policy (set ttl as custom attribute) -

<OAuthV2 async="false" continueOnError="false" enabled="true" name="OAuth-ValidateKeySecret">
    <DisplayName>OAuth-ValidateKeySecret</DisplayName>
   
    <Operation>GenerateAccessToken</Operation>    
    <ExpiresIn ref="token.ttl">400000</ExpiresIn>
    <SupportedGrantTypes>
        <GrantType>password</GrantType>
    </SupportedGrantTypes>
    <GrantType>request.formparam.grant_type</GrantType>
    <UserName>request.formparam.username</UserName>
    <PassWord>request.formparam.password</PassWord>
    <Attributes>
        <Attribute name="ttl" ref="token.ttl"> 400000 </Attribute>        
    </Attributes>
    <GenerateResponse enabled="true"/>
    <GenerateErrorResponse enabled="true"/>
</OAuthV2>

Get OAuth info (this is to read custom attribute ttl)

<GetOAuthV2Info async="false" continueOnError="false" enabled="true" name="GetOAuth-GetAttribute">
    <DisplayName>GetOAuth-GetAttribute</DisplayName>
    <RefreshToken ref="request.formparam.refreshtoken"/>
    <IgnoreAccessTokenStatus>true</IgnoreAccessTokenStatus>
</GetOAuthV2Info>

Token Refresh

<OAuthV2 async="false" continueOnError="false" enabled="true" name="OAuth-TokenRefresh">
    <DisplayName>OAuth-TokenRefresh</DisplayName>
    <Operation>RefreshAccessToken</Operation>
    <ExpiresIn ref="oauthv2accesstoken.GetOAuth-GetAttribute.accesstoken.ttl">400000</ExpiresIn>
    <GrantType>request.formparam.grant_type</GrantType>
    <RefreshToken>request.formparam.refreshtoken</RefreshToken>
    <GenerateResponse enabled="true"/>
</OAuthV2>

View solution in original post

7 REPLIES 7