Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

captcha Field Missing in DbSignUpOptions Typing in [email protected] #1471

Open
5 of 6 tasks
bluebeel opened this issue Nov 20, 2024 · 0 comments
Open
5 of 6 tasks
Labels
bug This points to a verified bug in the code

Comments

@bluebeel
Copy link

bluebeel commented Nov 20, 2024

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

  1. Enable CAPTCHA in the Auth0 Admin Settings.
  2. 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

@bluebeel bluebeel added the bug This points to a verified bug in the code label Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This points to a verified bug in the code
Projects
None yet
Development

No branches or pull requests

1 participant