Unable to access api endpoints with access token from mobile app

Ready to post? :mag: First, try searching for your answer.
Hello,
in my spring boot application (web-api), I get the following error when clients such as postman send requests to the web-api: Failed to authenticate since the JWT was invalid.

We have the following scenario:

We have two native mobile apps (iOS and Android) and one web api (Spring boot).
The web api is secured by auth0 and clients must first get an access token to interact with the api. Later the api must provide endpoints for creating a user, therefore we need access to the management api from our web api (machine to machine).

Therefore, I walk through the architecture scenarios (get-started/architecture-scenarios/mobile-api), but currently we are unable to get a valid jwt token. In postman I used the auth0 configuration (client id, client secret, auth endpoint, token endpoint, grant type auth code with pcke) from my ios mobile app to get an access token. We get an access token, but when I copy it to jwt io it says “invalid token”.

What are we doing wrong?

The response jwt token has the format

eyXYZ..XYZ

A jwt token has three parts: header.payload.signature.

The payload part is obviously empty.

Hi @mijo,

Welcome to the Auth0 Community and thank you for your post.

Since you are getting an Access Token, but it’s missing the payload this means that you are receiving an opaque token. Please make sure that you are passing the correct audience when making the request to the /authorize endpoint, as mentioned in our Get Access Token documentation.

You can refer to this community post or this Knowledge Artricle as well.

I hope this helped.
Best regards,
Remus

1 Like

Thank you very much!!