Getting JWT Access Token instead of Opaque Token from /oauth/token with Authorization Code Flow

Is it possible to get a signed JWT Access token when using Authentication API Explorer instead of an Opaque Token?

This would be really useful because it wouldn’t require changing App Settings and would allow us to use Auth0-generated JWT Access Tokens instead of having to sign our Auth Cookies.

Thanks in advance,
Marcelo.

@MarceloZ, Welcome to the Auth0 Community!

If you are looking for a JWT access token instead of a opaque token for Authorization, you can add the Appropriate “audience” parameter in the /authorize request of the Authorization code flow. Your audience will be the API identifier you need Authorization for.
https://auth0.com/docs/flows/call-your-api-using-the-authorization-code-flow

3 Likes

Thank you, Sidharth! It worked.

As feedback, one thing that would’ve helped as I searched the docs would’ve been if this were documented in the API reference. I was quite puzzled by the fact that the same Endpoint can return different types of Tokens depending on your parameters to it, and even though I had found that the audience parameter was required for the /oauth/token endpoint to trigger that behaviour for some Flows, the same parameter needs to be sent for a different endpoint/URL on the Flow I’m using, changing the returned token later on (and this behaviour is not documented in the API reference nor in the link that you sent).
In fact, it seems the link you reference says the audience parameter is mandatory, but we weren’t using it and things were working well - except, of course, for the Opaque Token we got later on.

Thanks for the help once again!

1 Like

Thanks for that feedback. We’ll pass that along to our docs team!

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