recaptcha icon indicating copy to clipboard operation
recaptcha copied to clipboard

https://www.google.com/recaptcha/api2/pat 401 (Unauthorized)

Open arebelof opened this issue 1 year ago • 30 comments

Hi,

When I have the Chrome's Device Toolbar active (CTRL + SHIFT + M), I'm getting this error on console when loading the page:

recaptcha__pt.js:805 POST https://www.google.com/recaptcha/api2/pat?k=<My Key> 401 (Unauthorized)

If I disable the device tollbar, there's no error.

image

image

image

Thank you.

arebelof avatar Sep 25 '24 13:09 arebelof

Same

mchamma avatar Oct 02 '24 03:10 mchamma

same here

borisb13 avatar Oct 05 '24 16:10 borisb13

same here how to solve it

guncv avatar Oct 07 '24 07:10 guncv

Same

andrewhood avatar Oct 14 '24 23:10 andrewhood

Same!

Berman59 avatar Oct 15 '24 16:10 Berman59

Same :(

TomerSH17 avatar Oct 16 '24 10:10 TomerSH17

Please stop saying "Same" like parrots. You're polluting the issue thread. Instead, upvote the initial comment, and subscribe to the issue

Image

notKamui avatar Oct 16 '24 13:10 notKamui

Additionally, I've noticed that when I use Safari dev tools to remotely connect to my iPhone and pull up dev tools in Safari, it seems this error occurs on every load

cududa avatar Oct 21 '24 17:10 cududa

cududa - thank you for sharing, that totally cleared everything up for me

Overriding the user agent without enabling device mode will still exhibit the same behavior

This user agent value does NOT exhibit this behavior in chrome's dev tools Mozilla/5.0 (iPhone; CPU iPhone OS 13_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/129.0.0.0 Mobile/15E148 Safari/604.1 Image

This user agent value DOES exhibit this behavior in chrome's dev tools Mozilla/5.0 (iPhone; CPU iPhone OS 16_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1 Image

jeremy-hunter avatar Oct 24 '24 23:10 jeremy-hunter

@jeremy-hunter

Yes, different user agents change the in dev tools - but in prod, testing on a real device I still get a 401.

I'm hoping Google doesn't close this issue, as it appears recaptcha just won't load on recent iOS versions and there's no guidance or documentation on the issue.

cududa avatar Oct 30 '24 04:10 cududa

Seems like the problem start when user agent has iPhone OS 16_0 and above. Its working fine till version iPhone OS 15_8.

NareshRoka avatar Oct 31 '24 07:10 NareshRoka

anyone has solved this issue please ?

dbrisson-passat avatar Oct 31 '24 07:10 dbrisson-passat

I see this issue on Safari Version 17.5 (19618.2.12.11.6) Is this because of CORS?

Cross-Origin-Opener-Policy-Report-Only: same-origin; Image

Also noticing other CSS and JS is returning a 401 response. Request Accept: / Cache-Control: no-cache Pragma: no-cache Referer: https://www.google.com/ Sec-Fetch-Dest: script Sec-Fetch-Mode: no-cors Sec-Fetch-Site: cross-site User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.5 Safari/605.1.15

Request Accept: / Cache-Control: no-cache Pragma: no-cache Referer: https://www.google.com/ Sec-Fetch-Dest: script Sec-Fetch-Mode: no-cors Sec-Fetch-Site: cross-site User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.5 Safari/605.1.15

Image

Working on Chrome 130.0.6723.92 (Official Build) (x86_64)

Working on Chrome Canary 132.0.6817.0 Request URL: https://www.gstatic.com/recaptcha/releases/-ZG7BC9TxCVEbzIO2m429usb/recaptcha__en.js Request Method: GET Status Code: 200 OK Remote Address: 142.251.215.227:443 Referrer Policy: strict-origin-when-cross-origin

Response Headers accept-ranges: bytes access-control-allow-origin: * age: 924 alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 cache-control: public, max-age=31536000 content-encoding: gzip content-length: 220347 content-security-policy-report-only: require-trusted-types-for 'script'; report-uri https://csp.withgoogle.com/csp/recaptcha content-type: text/javascript cross-origin-opener-policy: same-origin-allow-popups; report-to="recaptcha" cross-origin-resource-policy: cross-origin date: Mon, 04 Nov 2024 18:58:56 GMT expires: Tue, 04 Nov 2025 18:58:56 GMT last-modified: Tue, 22 Oct 2024 00:01:33 GMT report-to: {"group":"recaptcha","max_age":2592000,"endpoints":[{"url":"https://csp.withgoogle.com/csp/report-to/recaptcha"}]} server: sffe vary: Accept-Encoding x-content-type-options: nosniff x-xss-protection: 0 Request Headers: :authority: www.gstatic.com :method: GET :path: /recaptcha/releases/-ZG7BC9TxCVEbzIO2m429usb/recaptcha__en.js :scheme: https accept: / accept-encoding: gzip, deflate, br, zstd accept-language: en-US,en;q=0.9 cache-control: no-cache origin: https://.com pragma: no-cache referer: https://.com/ sec-ch-ua: "Not A(Brand";v="8", "Chromium";v="132", "Google Chrome";v="132" sec-ch-ua-mobile: ?1 sec-ch-ua-platform: "Android" sec-fetch-dest: script sec-fetch-mode: cors sec-fetch-site: cross-site user-agent: Mozilla/5.0 (Linux; Android 13; Pixel 7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Mobile Safari/537.36 x-client-data: CI+2yQEIo7bJAQirncoBCMv4ygEIlqHLAQia/swBCNX0zQEI4LrOAQjIws4BCJPEzgEI48XOAQiOxs4BCPHGzgEInMjOARiYr80B Decoded: message ClientVariations { // Active Google-visible variation IDs on this client. These are reported for analysis, but do not directly affect any server-side behavior. repeated int32 variation_id = [3300111, 3300131, 3313323, 3325003, 3330198, 3358490, 3373653, 3382624, 3383624, 3383827, 3384035, 3384078, 3384177, 3384348]; // Active Google-visible variation IDs on this client that trigger server-side behavior. These are reported for analysis and directly affect server-side behavior. repeated int32 trigger_variation_id = [3364760]; }

Working on Firefox latest build. 132.0

Not checking other Chromium browsers.

Rick-EESCOC avatar Nov 04 '24 19:11 Rick-EESCOC

Same here .. confirmed it happens only with iphone user agent .. but still happening.

nstiac avatar Dec 08 '24 04:12 nstiac

Same here .. confirmed it happens only with iphone user agent .. but still happening.

I can confirm this; it is the same issue on my sites.

kemalkastrataj avatar Dec 09 '24 02:12 kemalkastrataj

anyone have a solution for this issue or no?

dbrisson-passat avatar Dec 12 '24 08:12 dbrisson-passat

Is there any temporary solution for this?

jasminmistry avatar Jan 02 '25 12:01 jasminmistry

is there some update?

geanfarias avatar Jan 08 '25 16:01 geanfarias

Peas as always breaking everything and the developers has to fix theyr s*****. Any fix on this? This is a super bad bug... Gonna have to disable App Check while this isn't fixed.

elielson-anjos avatar Jan 10 '25 12:01 elielson-anjos

I wouldn't expect an answer in this repostory. I opened a discussion in the Google Cloud Security forums If anyone wants to contribute: https://www.googlecloudcommunity.com/gc/reCAPTCHA/reCAPTCHA-initialization-error-on-Safari-iOS-16/td-p/859376

tommag21 avatar Jan 10 '25 16:01 tommag21

It looks like this is a red herring error. I was getting the same error on safari and upon investigating the error more on safari on my macbook it turned out once I actually submitted the form I was getting an error about my query string being too long so IIS was rejecting my request. Basically for some reason in safari the getRecatpchaResponse function I had to determine if the user was a bot or not was about 2500 characters long. No idea why it was working in every browser but safari. Anyways I updated the max length of my query string to 3000 in IIS from 2048 and boom it started working again! Hope this can help someone else out but yeah most likely recaptcha is not working in safari due to another reason. Hit that submit button and see what error you get!

clark48j avatar Feb 07 '25 01:02 clark48j

is there are updates?

mmfarahat avatar Feb 19 '25 12:02 mmfarahat

I do not know if this helps but I found this thread:

https://www.googlecloudcommunity.com/gc/reCAPTCHA/reCAPTCHA-initialization-error-on-Safari-iOS-16/td-p/859376

mericlomlu avatar Feb 20 '25 12:02 mericlomlu

So TL;DR

Google are ducking clowns, and you can "safely ignore" the error, and they don't even plan on fixing it.

This is absolutely insane.

notKamui avatar Feb 21 '25 07:02 notKamui

Wasted too much time on this.

TL;DR: in the Chrome DevTools for iOS devices (iPhone, iPad...) we get a 401 on this URL:

https://www.google.com/recaptcha/api2/pat?k=‹google recaptcha client key›

It's annoying and polluting the console log. Does not prevent recaptcha from working. Does not occur on non-iOS in my experience.

EDIT:

  • I also sometimes got the error for non-iOS devices.

fabswt avatar Feb 22 '25 07:02 fabswt

same

r4g3ch33m5 avatar Mar 06 '25 07:03 r4g3ch33m5

I ran into this issue while developing the SMS authentication part of FireBase. Is this by any chance a configuration issue in the FireBase console?

chris1797 avatar Mar 12 '25 05:03 chris1797

Same

agustinFeijoo avatar Apr 10 '25 11:04 agustinFeijoo

same issue, safari 18.3.1 (20620.2.4.11.6)

almera-vs avatar Apr 19 '25 11:04 almera-vs

For anyone still running into this: This error seems to be related to Apple’s Private Access Tokens (PAT) feature on iOS/macOS devices, triggering a 401 on api2/pat.

Google staff confirmed here that it’s safe to ignore, as it doesn’t affect reCAPTCHA functionality. They're probably not gonna fix it.

Just one of those things—ignore it and carry on.

sebastianfeistl avatar May 07 '25 22:05 sebastianfeistl