OAuthV2 policy with client_credentials grant fails with error Unresolved variable : external_access_

Hi,

I've defined my  OAuthV2 policy  as below

 

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<OAuthV2 async="false" continueOnError="false" enabled="true" name="GenerateAccessTokenClientV2">
    <!-- This policy generates an OAuth 2.0 access token using the client_credentials grant type -->
    <Operation>GenerateAccessToken</Operation>
    <!-- This is in millseconds, so expire in an hour -->
    <ExpiresIn>30000</ExpiresIn>
    <ExternalAuthorization>false</ExternalAuthorization>
    <StoreToken>false</StoreToken>
    <SupportedGrantTypes>
        <GrantType>client_credentials</GrantType>
    </SupportedGrantTypes>
    <GrantType>request.formparam.grant_type</GrantType>
    <GenerateResponse enabled="true"/>
</OAuthV2>

 

 

But I still get an error

 

 

{"fault":{"faultstring":"Unresolved variable : external_access_token","detail":{"errorcode":"entities.UnresolvedVariable"}}}

 

Not sure why it is looking for external_access_token when I clearly mentioned grant_type client_credentials

0 1 88
1 REPLY 1

This could be related to your StoreToken attribute being set to false. It should be set false when using External Authorization.

https://cloud.google.com/apigee/docs/api-platform/reference/policies/oauthv2-policy#storetokenelemen...