Hi @philip.colmer,
Welcome to the Community!
You can request a token for any API you have registered with Auth0 by passing the API identifier (this is usually a URI) as the audience
claim in the token.
For example:
const auth = isBrowser
? new auth0.WebAuth({
domain: process.env.AUTH0_DOMAIN,
clientID: process.env.AUTH0_CLIENTID,
redirectUri: process.env.AUTH0_CALLBACK,
responseType: "token id_token",
scope: "openid profile email",
//ADD THIS LINE BELOW
audience: "{YOUR API IDENTIFIER}",
})
: {}
You should receive a JWT back. If you decode it on jwt.io then you should see the audience claim with the identifier you passed.
Here is a doc about how to set up an API:
If you want to request a new token intended for your API, you can add the audience to the checkSession
call like this:
https://auth0.com/docs/libraries/auth0js/v9#using-checksession-to-acquire-new-tokens
Let me know if you have any questions,
Dan