Empty payload in accessToken is not valid


I am using flutter as a frontend, the login works and I get a valid accessToken (valid because I can use this accessToken to the userProfile on the flutter side). When I want to use this accessToken in my backend, PyJWT crashes because the payload of the accessToken is empty. https://jwt.io/ also tells me that the accessToken is not valid ( invalid signature) with the warning “Looks like your JWT payload is not a valid JSON object. JWT payloads must be top level JSON objects as per RFC 7519: JSON Web Token (JWT)”.

This is my accessToken: eyJhbGciOiJkaXIiLCJlbmMiOiJBMjU2R0NNIiwiaXNzIjoiaHR0cHM6Ly9kZXYtb3NzMGpqMm90NTRjNTNlcC51cy5hdXRoMC5jb20vIn0…73aqD36lMmtxkB2d.1MV9uRDXBbaeod9QyWrevFkpDJo175dfUkKG1eMnen7ml28EnZo48d7ciGSghaCqtSbh70CcQI2pU9Iw3tlBso0Wpm2b1W5712OBPVDlnZWOF6YE7za1cU4rmJbUo90WlbQ8OnexwVMALgTibjWjin5bMeNEo9nwDTOagQaiwIJAlvXu-Q0RBPd3m1WUnJ0gMItU1mE1f0s74GF5AdscZXOt_4LrnXQ134p8U9DClEskpzpKckAXImTbMXzCsPJ8S2v3Jvm4z72CResW9rPz3MIl47Kn-BUxJ8d_5Kg9xto6k1Z0bC7ABq4K8ROtGMJzX971zbvy92aeliE3aMx-M7QHLlcYenziR5frL-82wrscUD7978c.3H4o6RUtDagT1a6WRTBpgw

How can I get a valid accessToken with a valid JSON as a payload?

Hi @BennyBe,

I understand that you have experienced issues getting a valid JWT Access Token.

Firstly, could you please clarify if you have included an audience in your login request?

Usually, when the login request omits the audience property, it results in opaque access tokens.

If this is the case, I recommend including the audience parameter in your login request to fix the issue. Please see our Get Access Tokens documentation for more information.

Please let me know how this goes.


Thank you, the example did not use audience, so I did not know I had to set it myself.

This worked for me:

final credentials = await controller.auth0.webAuthentication(scheme: "example-auth0").login(
    audience: '',

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