Description
Checklist
- The issue can be reproduced in the auth0-js sample app (or N/A).
- I have looked into the Readme and Examples, and have not found a suitable solution or answer.
- I have looked into the API documentation and have not found a suitable solution or answer.
- I have searched the issues and have not found a suitable solution or answer.
- I have searched the Auth0 Community forums and have not found a suitable solution or answer.
- I agree to the terms within the Auth0 Code of Conduct.
Description
We have enabled CAPTCHA in the Auth0 Admin Settings, and it functions correctly for the login flow. However, when using the signup method from [email protected] with CAPTCHA, there is a discrepancy in the TypeScript definitions for DbSignUpOptions. The captcha field is not recognized, leading to TypeScript errors.
Issue Details
The current [email protected]
TypeScript typings for the signup method are as follows:
signup(options: DbSignUpOptions, callback: Auth0Callback<any>): void;
The DbSignUpOptions type does not include a captcha field, but the API requires it when CAPTCHA is enabled.
Observed Behavior
Without the captcha field, the following error is returned from the API:
POST https://<TENANT_DOMAIN>/dbconnections/signup
401 Unauthorized
{
"statusCode": 401,
"description": "Invalid captcha value",
"name": "invalid_captcha",
"code": "invalid_captcha"
}
Adding the captcha field and bypassing the TypeScript error allows the signup to succeed.
Expected Behavior
The DbSignUpOptions TypeScript definition should include the captcha field to align with the API's requirements.
Reproduction
- Enable CAPTCHA in the Auth0 Admin Settings.
- Attempt to sign up a user with the signup method from [email protected] using the following code:
webAuth.signup(
{
connection: databaseConnection,
email,
password,
username,
captcha: captcha?.getValue(), // Error: 'captcha' does not exist in type 'DbSignUpOptions'
},
(error, result) => {
if (error) return handleCallbackFromAuth0(error, result);
console.log("ok");
}
);
Observe the TypeScript error:
TS Error: 'captcha' does not exist in type 'DbSignUpOptions'
When bypassing the TypeScript check with @ts-expect-error:
//@ts-expect-error bad typing
captcha: captcha?.getValue(),
The signup process works correctly, confirming that the API expects a captcha field.
Additional context
No response
auth0-js version
9.28.0
Which browsers have you tested in?
Chrome