Hello all,
I have been working with the api edge creating several PoCs. Currently, I’m stucked with one prove related with OAuth. Perhaps, you can give us some advice.
I have a proxy that generates a token for the user (https://apigeehost/oauth/). This is the OAuthV2 policy that handles this:
<?xml version="1.0" encoding="UTF-8"
standalone="yes"?><OAuthV2 async="false"
continueOnError="false" enabled="true" name="OA-GenerateAccessToken-Password">
<DisplayName>OA-GenerateAccessToken Password</DisplayName>
<Operation>GenerateAccessToken</Operation>
<!--<ExternalAccessToken>apigee.access_token</ExternalAccessToken>--> <!-- This is in
millseconds, so expire in an hour -->
<ExpiresIn>36000000</ExpiresIn>
<SupportedGrantTypes>
<GrantType>password</GrantType>
</SupportedGrantTypes>
<GrantType>request.formparam.grant_type</GrantType>
<UserName>request.formparam.username</UserName>
<PassWord>request.formparam.password</PassWord>
<GenerateResponse/>
<GenerateErrorResponse/> <Attributes> <Attribute
name="tc1cookietoken" ref="authenticate.response.content"
display="false"/>
</Attributes></OAuthV2>
Also, I have a reverse proxy (https://apigeehost/northwind-oauth) that validates the token with this policy:
<?xml version="1.0" encoding="UTF-8"
standalone="yes"?><OAuthV2 async="false"
continueOnError="false" enabled="true"
name="verify-oauth-v2-access-token">
<DisplayName>VerifyAccessToken</DisplayName>
<ExternalAuthorization>false</ExternalAuthorization>
<Operation>VerifyAccessToken</Operation>
<SupportedGrantTypes/>
<GenerateResponse enabled="true"/> <Tokens/></OAuthV2>
To test it, I make a request to the first proxy with this curl:
curl -X POST -H "Content-Type:
application/x-www-form-urlencoded" -H "apikey:
1kT9GI3inQYTzobMP75nfqkcA0LgKeC9" -H "Cache-Control: no-cache"
-H "Postman-Token: 02a854d8-9ed4-bd92-754f-1c50b7715eb4" -d
'grant_type=password&username={username}&password={password}&client_secret={secret}&client_id={client_id}'
[https://apigeehost/oauth/token](https://apigeehost/oauth/token)
I receive this response:
{
"issued_at": "1488179577189", "scope":
"",
"application_name": "89a2ff29-fee8-4880-a998-1a6495b37706",
"refresh_token_issued_at": "1488179577189", "status":
"approved",
"refresh_token_status": "approved",
"expires_in": "35999",
"token_type": "BearerToken",
"refresh_token": "Xpum9GAtS9X47Vl5GDsRr6K0zHS5iVBG", "client_id":
"1kT9GI3inQYTzobMP75nfqkcA0LgKeC9",
"access_token": "EPoAvqpGAaN5pxPHUmz4Z9HMir46",
"refresh_token_expires_in": "0",
"refresh_count": "0"}
Then, I make a request to the second proxy with the access_token.
curl -X GET -H "Authorization: Bearer
EPoAvqpGAaN5pxPHUmz4Z9HMir46" -H "Cache-Control: no-cache" -H
"Postman-Token: b50f7f5d-b539-91ff-02a0-b33396110463"
"https://apigeehost/northwind-oauth/v1/product "
The problem is that I get this response:
{ "fault": {
"faultstring": "Invalid access token",
"detail": {
"errorcode": "oauth.v2.InvalidAccessToken" } }}
I reviewed all the parameters and I tried to change some of them (for example, change the validate OAuth policy to read the token from the query parameters) but I’m not able to make it works. I’m sure that the problem should be a small detail, but I can’t find it. Could you help me with this?
Thank you very much.

