If I read the documentation of GetOAuthV2Info it looks like there is a way to retrieve custom attributes with refresh token. For example the output of the GetOAuthV2Info according to doco is as follows
oauthv2refreshtoken.{policy_name}.access_token oauthv2refreshtoken.{policy_name}.refresh_token oauthv2refreshtoken.{policy_name}.client_id oauthv2refreshtoken.{policy_name}.refresh_count oauthv2refreshtoken.{policy_name}.organization_name oauthv2refreshtoken.{policy_name}.refresh_token_expires_in oauthv2refreshtoken.{policy_name}.refresh_token_issued_at oauthv2refreshtoken.{policy_name}.refresh_token_status oauthv2refreshtoken.{policy_name}.developer.email oauthv2refreshtoken.{policy_name}.developer.id oauthv2refreshtoken.{policy_name}.developer.app.name oauthv2refreshtoken.{policy_name}.developer.app.id oauthv2refreshtoken.{policy_name}.{custom_attribute_name}
My question is how do I assign a custom attribute to a refresh token . I need to assign custom variables to refresh token and retrieve them before generating an access token in exchange of a refresh token.
Please help. Thanks.
Custom attribute which is set while generating access token can be retrieved while genrating access token using refresh token. If you need to update the attribute during refresh token you can use setouthv2 policy
Please refer below for more details.
Although in the document http://docs.apigee.com/api-services/reference/get-oauth-v2-info-policy oauthv2refreshtoken variable is used it doesn not seem to work, we have to use oauthv2accesstoken only to retrieve values during refresh token
Yes - documentation is wrong for Refresh Token Variables. At least for custom attributes you use the same flow variable as the access token ones.
I.e. oauthv2accesstoken.{policy_name}.accesstoken.{custom_attribute_name}
@Dave Pickard and @Veera Balaji Penugonda -- The GetOAuthV2Info doc has been corrected, as you both suggested. Thanks for catching that!
Note that if you set GetOAuthV2Info up to get refresh token info:
<GetOAuthV2Info name="GetTokenAttributes"> <RefreshToken ref="request.queryparam.refresh_token"/> </GetOAuthV2Info>
you can get back the custom attributes associated with the corresponding access token in a variable like this:
oauthv2refreshtoken.GetTokenAttributes.accesstoken.[custom-attribute-name]