Mr Wilde
Mr Wilde

Reputation: 659

When using auth0, I cannot gain access to the scope read:current_user

I would like to be able to view and update a user's metadata from a single page application but whenever I attempt to gain access to any of the scopes that would appear from the documentation (https://auth0.com/docs/libraries/auth0js/v9)

However, when I run the following code:

webAuth.checkSession(
  {
    audience: `https://mysite.eu.auth0.com/api/v2/`,
    scope: "read:current_user"
  },
  (err, result) => {
    err && console.log("err", err");
    result && console.log("result", result);
  }
);

I get the following error:

{error: "consent_required", error_description: "Consent required"}

I've tried putting the scope read:current_user in multiple places but it always appears to fail.

Upvotes: 1

Views: 481

Answers (1)

thameera
thameera

Reputation: 9473

The error means that the server is requesting an additional consent from the user, so checkSession cannot complete the action because it happens silently and cannot prompt the user.

To fix this, go to Auth0 dashboard -> APIs -> Auth0 Management API -> Settings tab -> uncheck 'Allow Skipping User Consent'.

Upvotes: 1

Related Questions