# Does a user get created on Auth0 Access Token Calls

**URL:** <https://community.directus.com/t/does-a-user-get-created-on-auth0-access-token-calls/280>\
**Category:** Help\
**Tags:** authentication, auth0\
**Created:** [May 10, 2025, 4:23am UTC](https://community.directus.com/t/does-a-user-get-created-on-auth0-access-token-calls/280 "2025-05-10T04:23:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![DonaldNgai](https://sea2.discourse-cdn.com/flex002/user_avatar/community.directus.com/donaldngai/32/255_2.png) [@DonaldNgai](https://community.directus.com/u/DonaldNgai)\
**Post date:** [May 10, 2025, 4:23am UTC](https://community.directus.com/t/does-a-user-get-created-on-auth0-access-token-calls/280/1 "2025-05-10T04:23:03Z")

</div>

I have my Directus instance setup so that it connects to Auth0. So that works.

I also have it setup so that AUTH\_AUTH0\_ALLOW\_PUBLIC\_REGISTRATION = true.

I can confirm this because if I login with Auth0, a new user is created.

However, I’m also trying to have my NextJS app get an access token to do GraphQL queries to my Directus app. When I do this though, I’m always met with “Invalid Credentials”. My thought is that my query is not enough to trigger a new user creation.:

```auto
    const accessToken = await auth0.getAccessToken()
    const client = new GraphQLClient(`${process.env.DIRECTUS_URL}/graphql`, {
        headers: {
            Authorization: `Bearer ${accessToken.token}`, // optional if needed
        },
    });

```

Anyone know whether or not this is how it’s supposed to work or perhaps I’m missing something?

---

<div class="post-metadata">

**Author:** ![DonaldNgai](https://sea2.discourse-cdn.com/flex002/user_avatar/community.directus.com/donaldngai/32/255_2.png) [@DonaldNgai](https://community.directus.com/u/DonaldNgai)\
**Post date:** [May 12, 2025, 4:18am UTC](https://community.directus.com/t/does-a-user-get-created-on-auth0-access-token-calls/280/2 "2025-05-12T04:18:07Z")

</div>

For those wondering for the future. Directus does NOT create a client on GraphQL queries even with a valid access token. Users are only created if you log in from the auth//login endpoint.

However, my workaround was to add a snippet of code in the getAccountabilityForToken function to use the external auth ID to identify the user when a valid access token is provided.
