How to get a users access token from auth-lock

I am using auth-lock in Angular 14 to show passwordless widget and am having issues getting the jwt token to send to our api. Heres how I am initialize the passwordless lock.

lock = new Auth0LockPasswordless('{Client ID}', '{Audience}', {
    autoclose: true,
    allowedConnections: ['email'],
    auth: {
      redirect: false,
      responseType: 'token id_token',
    },
  });

I am seeing a Opaque token and a JWT id token on the this.lock.on('authenticated', call. But the id token throws a 401, is there something I am missing here?

Hi @dev.invonto,

Welcome to the Auth0 Community!

You need to pass an audience parameter with the request. The second argument you are sending to Auth0LockPasswordless should be your auth domain (you can find it in your app settings in the dashboard).

For the audience, try passing it in the auth object literal. i.e.

...
auth: {
  ...
  audience: {AUDIENCE},
  ...
}
...

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