Question

I'm trying to use Apigee's GetOAuthv2Info policy but think I'm missing something really simple (still new to Apigee/APIs)...

The policy is configured based on the sample:

<GetOAuthV2Info name="GetTokenAttributes">
  <AccessToken>request.queryParam.access_token</AccessToken>
</GetOAuthV2Info>`

If I try to pass a valid token via a query parameter:

http://{host}/path/to/endpoint?access_token=tUbvXzh97UtRRUuBpGUNpXESJtD1, I get a 404 Not Found error code with:

{"fault":"{\"detail\":
{\"errorcode\":\"keymanagement.service.invalid_access_token\"},
\"faultstring\":\"Invalid Access Token\"}"}

Is this the correct way to pass the access token to the policy?

Thanks in advance!

Was it helpful?

Solution

Try:

<GetOAuthV2Info name="GetTokenAttributes">
  <AccessToken ref="request.queryparam.access_token"></AccessToken>
</GetOAuthV2Info>

or

<GetOAuthV2Info name="GetTokenAttributes">
  <AccessToken>{request.queryparam.access_token}</AccessToken>
</GetOAuthV2Info>

Your original policy is probably using the literal string value of request.queryParam.access_token as the token reference. Also noticed that queryparam is complete lower case.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top