Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

To fix Generate & VerifyJWTAccessToken Policy with OAuth 2.0

Our new requirement is to create a new JWT OAuth based JWTAccessToken in a API Proxy.

To achieve this we are using JWT OAuth tokens with OAuth 2.0 we have created a API Proxy called 2-legged-Oauth which generate and verify the JWT token.

By referring to the document we are able to generate the JWT token while hitting the (/v2/oauth/token/jwt/access) but when we tried to hit the Verify JWT token we are getting an error (/v2/oauth/token/jwt/verify) as below screenshot.

Kindly find the details which we configured at our end,

GenerateJWTAccessToken Policy:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<OAuthV2 name="GetAccessToken">
<Operation>GenerateJWTAccessToken</Operation>
<ExpiresIn>3600000</ExpiresIn>
<SupportedGrantTypes>
<GrantType>client_credentials</GrantType>
</SupportedGrantTypes>
<GenerateResponse enabled="false"/>
<Algorithm>RS256</Algorithm>
<PrivateKey>
<Value>
-----BEGIN RSA PRIVATE KEY-----
aXpkU5XBZVAg2w/+tM8HB/AJVxnS4zrq53ohmlaJmFPX0AbKm+rORTFWyyf4kw3G
xs3YC995hmFwqmSXvfjG7rve+d68/DcAt/2G4J+elz5fG0+8d7jBAnwPvRk8oeaY
-----END RSA PRIVATE KEY-----
</Value>
</PrivateKey>
</OAuthV2>

VerifyJWTAccessToken Policy:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<OAuthV2 async="false" continueOnError="false" enabled="true" name="VerifyAccessToken">
<DisplayName>VerifyAccessToken</DisplayName>
<ExternalAuthorization>false</ExternalAuthorization>
<Operation>VerifyJWTAccessToken</Operation>
<SupportedGrantTypes/>
<GenerateResponse enabled="false"/>
<Tokens/>
<Algorithm>RS256</Algorithm>
<PublicKey>
<Value> xTbXKgSXNg28by1eWRko1tJpAs31x8i46JUjJaVc7QyhJDe0TgwC5Qh9wJxq9W+xY53pClekEvjvrZfWi97M2z0pf8yRjv5TEcNO4zBdmnTL7bIw
</Value>
</PublicKey>
</OAuthV2>

Could any ine kindly assits us on what is missed over here to fix the issue?

Screenshot 2024-01-04 025139.png

Kindly assists us to resolve this query.

1 13 917
13 REPLIES 13