Retrieving JSON web token for API authentication

Hi there,

We’re new to using Auth0 and we’re trying to add some basic Auth0 authentication for our API.

We currently attempting to get a JWT from an authenticated user using:
await this.$auth.getTokenSilently();
in JavaScript, this does return a token however the token is a lot smaller than expected (around 25 characters)

We then add this token as a request header like so:
authorization: Bearer ***********************************

However we’re receiving a status 500 as a response from our API when we do this, are we getting the JWT in the correct way? If not can anyone advise on how we should be getting the JWT?

Any help is much appreciated! Thank you in advance.

Hi @ash.lewis

You must specify the audience for the API the token will be passed to (in the authorization header).