# Can't Validate Token w/JWT

**URL:** <https://community.auth0.com/t/cant-validate-token-w-jwt/107478>\
**Category:** Get Help\
**Tags:** authentication-sessions, sessions\
**Created:** [May 22, 2023, 12:30am UTC](https://community.auth0.com/t/cant-validate-token-w-jwt/107478 "2023-05-22T00:30:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![botgpt](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/botgpt/32/47433_2.png) [@botgpt](https://community.auth0.com/u/botgpt)\
**Post date:** [May 22, 2023, 12:30am UTC](https://community.auth0.com/t/cant-validate-token-w-jwt/107478/1 "2023-05-22T00:30:18Z")

</div>

I’ve been trying to validate a token with the code below, and I get the message “jwt.exceptions.InvalidAlgorithmError: The specified alg value is not allowed”. I also put the token in [https://jwt.io/](https://jwt.io/) and it says that there’s an invalid signature. But I can send the token to the userinfo endpoint, /userinfo, and I get my user info. Just trying to figure out why it appears to not be an RS256 encoded token. I looked through my advanced settings for my app and it says it’s RS256. I still get the same error message in the code below if I put “A256GCM” in “algorithms” in the code below. But that’s what [jwt.io](http://jwt.io) says it is.

try:  
payload = jwt.decode(  
access\_token,  
AUTH0\_CLIENT\_SECRET,  
algorithms=“RS256”,  
options={“verify\_exp”: True} # Verify token expiration  
)  
logger.info(f’payload: {payload}‘)  
current\_user = payload[‘sub’]  
logger.info(f’current\_user: {current\_user}’)

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [May 26, 2023, 11:13pm UTC](https://community.auth0.com/t/cant-validate-token-w-jwt/107478/3 "2023-05-26T23:13:07Z")

</div>

Hey there @botgpt welcome to the community!

The fact that you are unable to use this token against `/userinfo` leads me to believe it’s an opaque token you’re working with. This thread should help:

> [@Decode JWE's access token](https://community.auth0.com/t/decode-jwes-access-token/107508/3):
>
> Hey there @kito.hirokazu welcome to the community! This looks like an opaque access token - If you need to decode it at all, you’ll need to include an audience param when constructing the /authorize request. It depends on how you are initiating authorization, but the audience is typically set when configuring Auth0 - For example [AuthorizationParams](https://auth0.github.io/auth0-react/interfaces/AuthorizationParams.html#audience) in auth0-react. The following FAQs should be of use: [https://community.auth0.com/t/why-is-my-access-token-not-a-jwt-opaque-token/31028](https://community.auth0.com/t/why-is-my-access-token-not-a-jwt-opaque-token/31028)[https://c…](https://community.auth0.com/t/what-is-the-audience/71414)

Cheers!

---

<div class="post-metadata">

**Author:** ![botgpt](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/botgpt/32/47433_2.png) [@botgpt](https://community.auth0.com/u/botgpt)\
**Post date:** [May 27, 2023, 12:32am UTC](https://community.auth0.com/t/cant-validate-token-w-jwt/107478/4 "2023-05-27T00:32:11Z")

</div>

Yes, that was the case. Got help from Auth0 support and got it sorted out. Got some example code working right away, but getting it to work in my code was not as easy. But I eventually got it working. Thanks.

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [May 28, 2023, 3:53pm UTC](https://community.auth0.com/t/cant-validate-token-w-jwt/107478/5 "2023-05-28T15:53:27Z")

</div>

Thanks for following up with the community!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [June 11, 2023, 3:54pm UTC](https://community.auth0.com/t/cant-validate-token-w-jwt/107478/6 "2023-06-11T15:54:06Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
