# Authenticate (Code: 20003) error with an auth0\_idp\_error

**URL:** <https://community.auth0.com/t/authenticate-code-20003-error-with-an-auth0-idp-error/186894>\
**Category:** Get Help\
**Tags:** passwordless-email-connection, free-trial, connections\
**Created:** [May 19, 2025, 11:27am UTC](https://community.auth0.com/t/authenticate-code-20003-error-with-an-auth0-idp-error/186894 "2025-05-19T11:27:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pulkit.gupta](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/pulkit.gupta/32/74837_2.png) [@pulkit.gupta](https://community.auth0.com/u/pulkit.gupta)\
**Post date:** [May 19, 2025, 11:27am UTC](https://community.auth0.com/t/authenticate-code-20003-error-with-an-auth0-idp-error/186894/1 "2025-05-19T11:27:41Z")

</div>

We are encountering an Authenticate (Code: 20003) error with an auth0\_idp\_error when attempting to create a user via the Auth0 Management API’s /api/v2/users endpoint from our backend application.

We are using a Machine to Machine application (Grizzly Server API Management New) with the Client Credentials flow to obtain a token for the Auth0 Management API audience ([https://grizzlyapp.auth0.com/api/v2/](https://grizzlyapp.auth0.com/api/v2/)).

We have verified that:

- The backend uses the correct credentials and audience to obtain the M2M token.

- The M2M token has the necessary permissions for the Management API (e.g., read:roles, create:users) as confirmed by a successful curl test to /api/v2/roles using the token.

- The backend calls the Management API endpoints (/api/v2/…) on our custom Auth0 domain (auth.grizzlyforce.ca) with correct URL construction.

- The database connection name (Username-Password-Authentication) used in the user creation request matches the name in Auth0.

- Custom database scripts are not enabled for this connection.

- We are within our free plan limits for MAUs and M2M tokens.

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [May 19, 2025, 5:55pm UTC](https://community.auth0.com/t/authenticate-code-20003-error-with-an-auth0-idp-error/186894/3 "2025-05-19T17:55:20Z")

</div>

Hi @pulkit.gupta,

Welcome to the Auth0 Community!

It seems that the `Authenticate (Code: 20003) error with an auth0_idP` error might indicate a permission denied issue.

However, after looking at your [tenant logs](https://manage.auth0.com/#/logs), I found many `sapi` logs for creating a user with the Management API. These were also recent events, which justify the ability to create users (the token has the correct permissions).

Given that, could you please clarify if you are still experiencing this issue?

If so, could you please share the full error code, message, and description?

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![pulkit.gupta](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/pulkit.gupta/32/74837_2.png) [@pulkit.gupta](https://community.auth0.com/u/pulkit.gupta)\
**Post date:** [May 20, 2025, 5:13am UTC](https://community.auth0.com/t/authenticate-code-20003-error-with-an-auth0-idp-error/186894/4 "2025-05-20T05:13:22Z")

</div>

Hi rueben,

Appreciate you checking our logs. We are indeed still encountering the Authenticate (Code: 20003) error you mentioned.

This issue is currently affecting our production environment. It was functioning without problems until about a week ago, making this a critical issue for us right now.

Given that the token permissions appear correct based on your findings, could you please take a deeper look into what might be causing this auth0\_idp\_error specifically during user creation?

{  
error: Error: Error: Authenticate (Code: 20003)  
at AuthService.createUserAccount (D:\grizzlyserver-rs-stage\packages\server\src\services\AuthService.ts:172:19)  
at processTicksAndRejections (node:internal/process/task\_queues:95:5)  
at async AuthService.registerEmployer (D:\grizzlyserver-rs-stage\packages\server\src\services\AuthService.ts:226:27)  
at async EmployerResolver.createEmployer (D:\grizzlyserver-rs-stage\packages\server\src\modules\employer\resolver.ts:309:35)  
}

```auto
private async createUserAccount(
        email: string,
        password: string,
        accountType: AuthAccountTypes,
        connection: string = "Username-Password-Authentication",
        phoneNumber?: string,
    ): Promise<string> {
        try {
            await this.requestAccessToken();

            const params: any = {
                email,
                connection,
                user_metadata: { userType: accountType },
                app_metadata: { roles: [accountType] },
            };

            if (connection === 'Username-Password-Authentication') {
                params.password = password;
            }

            if (connection === 'sms') {
                params.phone_number = phoneNumber;
            }

            const createUserResponse = await fetch(`${this.domain}api/v2/users`, {
                method: "POST",
                headers: this.header,
                body: JSON.stringify(params),
            });

            const createUserJSON: any = await createUserResponse.json();

            if (createUserResponse.status !== 201) {
                throw new Error(createUserJSON.message);
            }

            return createUserJSON.user_id;
        } catch (error) {
            throw new Error(error);
        }

    }

```

```auto
   public async getRoleId(role: AuthAccountRoleNames): Promise<string> {
        await this.requestAccessToken();

        const rolesResponse = await fetch(`${this.domain}api/v2/roles`, {
            method: "GET",
            headers: this.header,
        });

        if (rolesResponse.status !== 200) {
            throw new Error(rolesResponse.statusText);
        }

        const roles: any = await rolesResponse.json();

        const { id } = roles.find(({ name }: { name: string }) => name === role);

        if (!id) {
            throw new Error("Could not find the given role");
        }

        return id;
    }

```

---

<div class="post-metadata">

**Author:** ![pulkit.gupta](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/pulkit.gupta/32/74837_2.png) [@pulkit.gupta](https://community.auth0.com/u/pulkit.gupta)\
**Post date:** [May 22, 2025, 4:40pm UTC](https://community.auth0.com/t/authenticate-code-20003-error-with-an-auth0-idp-error/186894/5 "2025-05-22T16:40:04Z")

</div>

Hi rueben,

Appreciate you checking our logs. We are indeed still encountering the Authenticate (Code: 20003) error you mentioned.

This issue is currently affecting our production environment. It was functioning without problems until about a week ago, making this a critical issue for us right now.

Given that the token permissions appear correct based on your findings, could you please take a deeper look into what might be causing this auth0\_idp\_error specifically during user creation?

{  
error: Error: Error: Authenticate (Code: 20003)  
at AuthService.createUserAccount (D:\grizzlyserver-rs-stage\packages\server\src\services\AuthService.ts:172:19)  
at processTicksAndRejections (node:internal/process/task\_queues:95:5)  
at async AuthService.registerEmployer (D:\grizzlyserver-rs-stage\packages\server\src\services\AuthService.ts:226:27)  
at async EmployerResolver.createEmployer (D:\grizzlyserver-rs-stage\packages\server\src\modules\employer\resolver.ts:309:35)  
}

```auto
private async createUserAccount(
        email: string,
        password: string,
        accountType: AuthAccountTypes,
        connection: string = "Username-Password-Authentication",
        phoneNumber?: string,
    ): Promise<string> {
        try {
            await this.requestAccessToken();

            const params: any = {
                email,
                connection,
                user_metadata: { userType: accountType },
                app_metadata: { roles: [accountType] },
            };

            if (connection === 'Username-Password-Authentication') {
                params.password = password;
            }

            if (connection === 'sms') {
                params.phone_number = phoneNumber;
            }

            const createUserResponse = await fetch(`${this.domain}api/v2/users`, {
                method: "POST",
                headers: this.header,
                body: JSON.stringify(params),
            });

            const createUserJSON: any = await createUserResponse.json();

            if (createUserResponse.status !== 201) {
                throw new Error(createUserJSON.message);
            }

            return createUserJSON.user_id;
        } catch (error) {
            throw new Error(error);
        }

    }

```

```auto
   public async getRoleId(role: AuthAccountRoleNames): Promise<string> {
        await this.requestAccessToken();

        const rolesResponse = await fetch(`${this.domain}api/v2/roles`, {
            method: "GET",
            headers: this.header,
        });

        if (rolesResponse.status !== 200) {
            throw new Error(rolesResponse.statusText);
        }

        const roles: any = await rolesResponse.json();

        const { id } = roles.find(({ name }: { name: string }) => name === role);

        if (!id) {
            throw new Error("Could not find the given role");
        }

        return id;
    }

```
