[GH-ISSUE #1332] Support Google ReCAPTCHA #8695

Closed
opened 2026-04-13 03:51:28 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @0scrm on GitHub (Feb 2, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/1332

Is this suited for github?

  • Yes, this is suited for github

It is often a good idea to put some endpoints behind a CAPTCHA challenge. The sign-up, sign-in and forgot password endpoints exposed by better-auth could benefit from such security.

Describe the solution you'd like

This would be a perfect candidate for a plugin. Using the middleware to get a captcha response token, we could then submit it to Google ReCAPTCHA and only let the request through if the challenge is passed.
The plugin would allow for custom "protected endpoints" array, so fit all use-cases.

Describe alternatives you've considered

Without creating a custom plugin, I cannot think of a way to protect the better-auth default endpoints behind a CAPTCHA challenge. Unless we don't use the better-auth client and build custom endpoints.

Additional context

A very similar Cloudflare Turnstile plugin is part of the 1.2 release: https://github.com/better-auth/better-auth/pull/957

Originally created by @0scrm on GitHub (Feb 2, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/1332 ### Is this suited for github? - [x] Yes, this is suited for github ### Is your feature request related to a problem? Please describe. It is often a good idea to put some endpoints behind a CAPTCHA challenge. The sign-up, sign-in and forgot password endpoints exposed by better-auth could benefit from such security. ### Describe the solution you'd like This would be a perfect candidate for a plugin. Using the middleware to get a captcha response token, we could then submit it to Google ReCAPTCHA and only let the request through if the challenge is passed. The plugin would allow for custom "protected endpoints" array, so fit all use-cases. ### Describe alternatives you've considered Without creating a custom plugin, I cannot think of a way to protect the better-auth default endpoints behind a CAPTCHA challenge. Unless we don't use the better-auth client and build custom endpoints. ### Additional context A very similar Cloudflare Turnstile plugin is part of the 1.2 release: https://github.com/better-auth/better-auth/pull/957
GiteaMirror added the locked label 2026-04-13 03:51:28 -05:00
Author
Owner

@0scrm commented on GitHub (Feb 4, 2025):

@Bekacru do you think it makes sense to have a separate plugin for ReCAPTCHA and Cloudflare Turnstile? Or should we have a generic "captcha" plugin that accepts multiple providers?

<!-- gh-comment-id:2635238009 --> @0scrm commented on GitHub (Feb 4, 2025): @Bekacru do you think it makes sense to have a separate plugin for ReCAPTCHA and Cloudflare Turnstile? Or should we have a generic "captcha" plugin that accepts multiple providers?
Author
Owner

@Bekacru commented on GitHub (Feb 5, 2025):

@0scrm yeah was thinking about that. I think it makes more sense to have one plugin that serves different providers.

<!-- gh-comment-id:2636326918 --> @Bekacru commented on GitHub (Feb 5, 2025): @0scrm yeah was thinking about that. I think it makes more sense to have one plugin that serves different providers.
Author
Owner

@0scrm commented on GitHub (Feb 5, 2025):

Alright! Since the apis are similar it shouldn't be too much work to support different providers. I'll update #957 to be generic and have a provider parameter.
When is v1.2.0 due for release? Depending on that I might be able to add Google ReCaptcha to my original PR.

<!-- gh-comment-id:2637911431 --> @0scrm commented on GitHub (Feb 5, 2025): Alright! Since the apis are similar it shouldn't be too much work to support different providers. I'll update #957 to be generic and have a `provider` parameter. When is v1.2.0 due for release? Depending on that I might be able to add Google ReCaptcha to my original PR.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#8695