Skip to content

Conversation

Velka-DEV
Copy link
Contributor

No description provided.

@AlexProgrammerDE
Copy link
Contributor

AlexProgrammerDE commented Aug 10, 2025

By default better auth doesn't enforce captchas on anything except ["/sign-up/email", "/sign-in/email", "/forget-password",]
Source: https://www.better-auth.com/docs/plugins/captcha#plugin-options
So maybe make this a toggleable feature? By default this wouldn't be a needed captcha and make devs incorrectly think the email otp endpoint is protected.

@Velka-DEV
Copy link
Contributor Author

Hey @AlexProgrammerDE,

I think this check is already in place here

    if (action) {
        const endpoints = captcha.endpoints || DEFAULT_CAPTCHA_ENDPOINTS
        if (!endpoints.includes(action)) {
            return null
        }
    }

The endpoint need to be enabled in the configuration to display the captcha

@AlexProgrammerDE
Copy link
Contributor

AlexProgrammerDE commented Aug 13, 2025

Yes, you are showing me the relevant line of code, however this list doesn't appear to include the email otp endpoint. Maybe I am missing something

// Default captcha endpoints
const DEFAULT_CAPTCHA_ENDPOINTS = [
"/sign-up/email",
"/sign-in/email",
"/forget-password"
]

@Velka-DEV
Copy link
Contributor Author

Like MagicLink, the email OTP captcha endpoint needs to be added when initializing the AuthUIProvider component:

      <AuthUIProvider
        emailOtp
        captcha={{
          provider: 'cloudflare-turnstile',
          siteKey: import.meta.env.VITE_TURNSTILE_SITEKEY,
          endpoints: [
            '/email-otp/send-verification-otp'
          ]
        }}
        [...]
      >

While it's already togglable, you're right that we should consider adding an example to the documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants