# User details not accesible when scope is defined

**URL:** <https://community.auth0.com/t/user-details-not-accesible-when-scope-is-defined/114757>\
**Category:** Get Help\
**Tags:** users, management-api\
**Created:** [August 29, 2023, 2:26pm UTC](https://community.auth0.com/t/user-details-not-accesible-when-scope-is-defined/114757 "2023-08-29T14:26:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![fabianjost](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/fabianjost/32/50282_2.png) [@fabianjost](https://community.auth0.com/u/fabianjost)\
**Post date:** [August 29, 2023, 2:26pm UTC](https://community.auth0.com/t/user-details-not-accesible-when-scope-is-defined/114757/1 "2023-08-29T14:26:18Z")

</div>

I am trying to build a Gatsby app. I am wrapping my root component in the following was:

```auto
<Auth0Provider
      domain={process.env.GATSBY_AUTH0_DOMAIN}
      clientId={process.env.GATSBY_AUTH0_CLIENTID}
      authorizationParams={{
        redirect_uri: window.location.origin,
        audience: audience,
        scope: "read:current_user update:current_user_metadata"
      }}
      onRedirectCallback={onRedirectCallback}
      useRefreshTokens={true}
      cacheLocation="localstorage"
    >
      {element}
    </Auth0Provider>

```

Later on I access the username like this:

```auto
const {
    isAuthenticated,
    logout,
    user,
  } = useAuth0();

return isAuthenticated && (
    <>
      <p className='text-xl' >Hi {user.email}</p>
</>
 );

```

Whenever I am not specifying a scope, this works perfectly fine. When I am specifying a scope (which I need to access the management api to change the user metadata), the only information I am getting from the user object is the user.sub. I searched up and down the web and cannot find a solution to this.  
Is anyone facing a similar issue and can tell me what I am missing here?

---

<div class="post-metadata">

**Author:** ![fabianjost](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/fabianjost/32/50282_2.png) [@fabianjost](https://community.auth0.com/u/fabianjost)\
**Post date:** [August 29, 2023, 2:41pm UTC](https://community.auth0.com/t/user-details-not-accesible-when-scope-is-defined/114757/2 "2023-08-29T14:41:47Z")

</div>

Of course a really dumb mistake. The default scope namely openid profile and email also needs to be passed. I was not able to find the default scope in the docu however, but only in the migration guide [https://github.com/auth0/auth0-react/blob/master/MIGRATION\_GUIDE.md#changes-to-default-scopes](https://github.com/auth0/auth0-react/blob/master/MIGRATION_GUIDE.md#changes-to-default-scopes)

```auto
scope: "openid profile email read:current_user update:current_user_metadata"

```

Hope that helps anyone facing the same problem.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [September 12, 2023, 2:42pm UTC](https://community.auth0.com/t/user-details-not-accesible-when-scope-is-defined/114757/3 "2023-09-12T14:42:22Z")

</div>

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