I need to use google token in ApigeeX proxy to directly change target server via management api. For that i also try with in ServiceCallOut Policy but it is throwing 401 as an response.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ServiceCallout async="false" continueOnError="true" enabled="true" name="SC-CallOICSecondary">
<Request clearPayload="true">
<Remove>
<Headers>
<Header name="Authorization"/>
</Headers>
</Remove>
<Set>
<Headers>
<Header name="Content-Type">application/json</Header>
<Header name="accept">application/json</Header>
</Headers>
<Payload>
{"name":"Test-PRIMARY","host":"d-integration.cloud.com","port":443,"isEnabled":true,"sSLInfo":{"enabled":true,"ciphers":[],"protocols":[],"clientAuthEnabled":false,"trustStore":""},"protocol":"HTTP"}
</Payload>
<Verb>PUT</Verb>
<Path/>
</Set>
<IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
</Request>
<Response>authenticate_response_secondary</Response>
<Timeout>30000</Timeout>
<HTTPTargetConnection>
<Authentication>
<GoogleAccessToken>
<Scopes>
<Scope>https://www.googleapis.com/auth/cloud-platform</Scope>
</Scopes>
</GoogleAccessToken>
</Authentication>
<URL>https://apigee.googleapis.com/v1/organizations/apigee-test/environments/test/targetservers/Test-PRIMARY</URL>
</HTTPTargetConnection>
</ServiceCallout>