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)
}
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);
}
}
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;
}