Refresh token not working when generated externally

Not applicable

HI

I need to use accesstoken and refreshtoken externally. I call ServiceCallout to get both and use GenerateAccessToken to set accessToken and refreshToken. So far so good.

But when I use RefreshAccessToken policy with correct refresh token it still shows error that incorrect refresh token. I have tried both true and false for <ReuseRefreshToken>true</ReuseRefreshToken>. Im using grant_type as refresh_token

Thanks Vi

0 2 293
2 REPLIES 2

Show your GenerateAccessToken policy

Use case is like this:
1. Get AccessToken and RefreshToken by calling ServiceCallout(Works Fine)
2. Get new AccessToken and RefreshToken by calling ServiceCallout by passing old refresh token.
3. Problem occurs when I try to update AccessToken and RefreshToken using these new values.

Please help.

Following is refresh token policy i'm trying to use.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<OAuthV2 async="false" continueOnError="false" enabled="true" name="OAuth-v20-1">
    <DisplayName>OAuth v2.0-1</DisplayName>
    <Operation>RefreshAccessToken</Operation>
    <ExternalAuthorization>true</ExternalAuthorization>
    <ExternalAccessToken>ws.Naccess_token</ExternalAccessToken>
    <ExternalRefreshToken>ws.Nrefresh_token</ExternalRefreshToken>
    <ReuseRefreshToken>true</ReuseRefreshToken>
    <StoreToken>true</StoreToken>
    <GenerateResponse enabled="false"/>
</OAuthV2>

Following is generate token policy

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<OAuthV2 name="GenerateAccessTokenClient">
     <Operation>GenerateAccessToken</Operation>
    <ExternalAuthorization>true</ExternalAuthorization>
    <SupportedGrantTypes>
    <GrantType>client_credentials</GrantType>
    </SupportedGrantTypes>
    <GrantType>request.queryparam.grant_type</GrantType>
    <ExternalAccessToken>ws.Naccess_token</ExternalAccessToken>
    <ExternalRefreshToken>ws.Nrefresh_token</ExternalRefreshToken>
    <ReuseRefreshToken>true</ReuseRefreshToken>
    <StoreToken>true</StoreToken>
    <GenerateResponse enabled="false"/>
</OAuthV2>