[GH-ISSUE #3803] Incorrect captcha header name in reCAPTCHA integration guide #9729

Closed
opened 2026-04-13 05:24:27 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @issam-seghir on GitHub (Aug 5, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/3803

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

Firsofall the better-auth documentation mentions using x-captcha-response as the header name for sending reCAPTCHA tokens, but the actual working header name is x-captcha-token.

also bcz i can't log this plugin behavior (whis is i mention in another issus #3804 )
i don't know if also ip header is sanded correctly bcz it's optional so i want to confirm if the doc mentions the currect header for IP address also?

Current vs. Expected behavior

  • better-auth version: 1.3.4
  • reCAPTCHA provider: google-recaptcha
  • reCAPTCHA version: v3 Enterprise

Expected Behavior

The documentation should accurately reflect the correct header name that the captcha plugin expects.

Actual Behavior

  • Documentation suggests using x-captcha-response
  • The captcha plugin actually expects x-captcha-token
  • This mismatch causes requests to fail with "Missing CAPTCHA response" errors

Steps to Reproduce

  1. Follow the better-auth reCAPTCHA integration documentation
  2. Implement client-side code using x-captcha-response header as suggested
  3. Submit a form with reCAPTCHA token
  4. Observe server logs showing "Missing CAPTCHA response" error
  5. Change header to x-captcha-token - request succeeds

What version of Better Auth are you using?

1.3.4

Provide environment information

windows 10 
chrome 
nextjs 15

Which area(s) are affected? (Select all that apply)

Documentation, Package

Auth config (if applicable)

import { betterAuth } from "better-auth"
export const auth = betterAuth({
  emailAndPassword: {  
    enabled: true
  },
});

Additional context

also bcz i can't log this plugin behavior (whis is i mention in another issus here)
i don't know if also ip header is sanded correctly bcz it's optional so i want to confirm if the doc mentions the currect header for IP address also?

Originally created by @issam-seghir on GitHub (Aug 5, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/3803 ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce Firsofall the better-auth documentation mentions using `x-captcha-response` as the header name for sending reCAPTCHA tokens, but the actual working header name is `x-captcha-token`. also bcz i can't log this plugin behavior (whis is i mention in another issus #3804 ) i don't know if also ip header is sanded correctly bcz it's optional so i want to confirm if the doc mentions the currect header for IP address also? ### Current vs. Expected behavior - better-auth version: 1.3.4 - reCAPTCHA provider: google-recaptcha - reCAPTCHA version: v3 Enterprise ### Expected Behavior The documentation should accurately reflect the correct header name that the captcha plugin expects. ### Actual Behavior - Documentation suggests using `x-captcha-response` - The captcha plugin actually expects `x-captcha-token` - This mismatch causes requests to fail with **"Missing CAPTCHA response"** errors ### Steps to Reproduce 1. Follow the better-auth reCAPTCHA integration documentation 2. Implement client-side code using `x-captcha-response` header as suggested 3. Submit a form with reCAPTCHA token 4. Observe server logs showing "Missing CAPTCHA response" error 5. Change header to `x-captcha-token` - request succeeds ### What version of Better Auth are you using? 1.3.4 ### Provide environment information ```bash windows 10 chrome nextjs 15 ``` ### Which area(s) are affected? (Select all that apply) Documentation, Package ### Auth config (if applicable) ```typescript import { betterAuth } from "better-auth" export const auth = betterAuth({ emailAndPassword: { enabled: true }, }); ``` ### Additional context also bcz i can't log this plugin behavior (whis is i mention in another issus here) i don't know if also ip header is sanded correctly bcz it's optional so i want to confirm if the doc mentions the currect header for IP address also?
GiteaMirror added the locked label 2026-04-13 05:24:27 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Aug 5, 2025):

The better-auth code for version 1.3.4 expects the reCAPTCHA token in the header named x-captcha-response, not x-captcha-token. If this header is missing, you'll get a "Missing CAPTCHA response" error. The documentation does not clearly specify this, which can cause confusion. For the user's IP address, the code checks the optional header x-captcha-user-remote-ip—this is also not well documented, but it is the expected header for passing the client IP if needed. You can configure which IP headers are checked in your auth config under advanced.ipAddress.ipAddressHeaders (for example: ["x-forwarded-for", "x-real-ip"]) [source].

If using x-captcha-token works in your setup, it may be due to custom middleware or proxy logic outside of better-auth itself, but the plugin's code expects x-captcha-response. To avoid issues, use x-captcha-response for the token and x-captcha-user-remote-ip for the IP address. The documentation should be updated to clarify these header names.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Chat with Dosu Join Discord Share on X

<!-- gh-comment-id:3155260670 --> @dosubot[bot] commented on GitHub (Aug 5, 2025): <!-- Answer --> The better-auth code for version 1.3.4 expects the reCAPTCHA token in the header named `x-captcha-response`, not `x-captcha-token`. If this header is missing, you'll get a "Missing CAPTCHA response" error. The documentation does not clearly specify this, which can cause confusion. For the user's IP address, the code checks the optional header `x-captcha-user-remote-ip`—this is also not well documented, but it is the expected header for passing the client IP if needed. You can configure which IP headers are checked in your auth config under `advanced.ipAddress.ipAddressHeaders` (for example: `["x-forwarded-for", "x-real-ip"]`) [[source]](https://github.com/better-auth/better-auth/blob/669ce3e6b737ce7c1a9ce982bf092f00d7373fbc/packages/better-auth/src/plugins/captcha/index.ts). If using `x-captcha-token` works in your setup, it may be due to custom middleware or proxy logic outside of better-auth itself, but the plugin's code expects `x-captcha-response`. To avoid issues, use `x-captcha-response` for the token and `x-captcha-user-remote-ip` for the IP address. The documentation should be updated to clarify these header names. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/039d9bbf-df9c-4932-a54e-63304f630734?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/039d9bbf-df9c-4932-a54e-63304f630734?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/039d9bbf-df9c-4932-a54e-63304f630734?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/039d9bbf-df9c-4932-a54e-63304f630734?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/039d9bbf-df9c-4932-a54e-63304f630734?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/039d9bbf-df9c-4932-a54e-63304f630734?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/039d9bbf-df9c-4932-a54e-63304f630734?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/cdda13d9-dd27-4d31-b09a-5d8bec92de21/ask?utm_source=github)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/better-auth/better-auth/issues/3803)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#9729