Hi,
I am trying to implement Oauth Policy with External Authorization ( Google ). I’m able to generate authorization code with google from call out policy. After that i used extract policy to fetch access_token from JSON response and set it in variable. After that i used assign message policy to set
oauth_external_authorization_status variable to true. After that i have OAuthV2 policy to store the token. But i was getting error :
<code>{"ErrorCode" : "invalid_client", "Error" :"Client identifier is required"}<br><br>
Then i set client_id which i used to generate Google code in the same assign message policy where i set oauth_external_authorization_status in FormParams
Now i’m getting error :
{“ErrorCode” : “invalid_client”, “Error” :“ClientId is Invalid”}
It means, it is picking this client_id but its not liking the way its set. I’m giving the hard coded value of client_id ( Base 64 encoding ) in the policy but getting same error.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ExtractVariables name="ExtractAccessToken">
<Source>GoogleOAuthTokenResponse</Source>
<JSONPayload>
<Variable name="accessToken">
<JSONPath>$.access_token</JSONPath>
</Variable>
</JSONPayload>
<IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
</ExtractVariables>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<AssignMessage name="AssignMessage-TokenSetVariable">
<DisplayName>Assign Message - Set Variable</DisplayName>
<Set>
<FormParams>
<FormParam name="client_id">xxxxxxxxxxxxx</FormParam>
</FormParams>
</Set>
<AssignVariable>
<Name>oauth_external_authorization_status</Name>
<Value>true</Value>
</AssignVariable>
<AssignTo createNew="false" transport="http" type="request"/>
<IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
</AssignMessage>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<OAuthV2 name="OAuth-v20-Store-External-Token">
<DisplayName>OAuth v2.0 1</DisplayName>
<Attributes/>
<ExternalAccessToken>request.queryparam.accessToken</ExternalAccessToken>
<ExternalAuthorization>true</ExternalAuthorization>
<Operation>GenerateAccessToken</Operation>
<GenerateResponse enabled="true">
<Format>FORM_PARAM</Format>
</GenerateResponse>
<ReuseRefreshToken>false</ReuseRefreshToken>
<StoreToken>true</StoreToken>
<Tokens/>
</OAuthV2>
Any advice would be really helpful.
Thanks