React-google-login: In Chrome, works regularly but not in Incognito Mode

Created on 20 Sep 2020  路  13Comments  路  Source: anthonyjgrove/react-google-login

I have this google login configuration
<GoogleLogin clientId={GOOGLE_CLIENT_ID} onSuccess={responseGoogle} onFailure={responseGoogle} accessType='offline' responseType='code' prompt='select_account' uxMode='redirect' redirectUri='http://localhost:3000/workspace/' render={(renderProps) => ( <button className='GoogleSignInButton Primary' onClick={renderProps.onClick} disabled={renderProps.disabled}> <FcGoogle size={24} className='GoogleIcon' /> Sign In with Google </button> )} />

It works regularly in Google Chrome, but when I try it in Incognito mode, I keep getting this error: popup_closed_by_user.

Any idea why it would work regularly but not in Incognito Mode?

Most helpful comment

For those having this error in incognito mode:

{error: "idpiframe_initialization_failed", details: "Cookies are not enabled in current environment."}

This is actually caused by the browser blocking third party cookies, so you have to handle this error and/or display the user a proper explanation on how to allow them.

On Chrome by clicking the eye showing up in the address bar, you should be able to toggle that after clicking the text in blue:

 blocked3pc

All 13 comments

I'm having a similar issue but for me I'm seeing this error message.
{error: "idpiframe_initialization_failed", details: "Cookies are not enabled in current environment."}
I have a feeling it's something to do with the way Chrome is handling cookies in incognito. If I'm not wrong they made a recent change to this in the most recent update.

Same issue, looking for a resolution

Facing the same issue. Anyone have any idea how to resolve it.

https://github.com/anthonyjgrove/react-google-login/issues/370#issuecomment-691847047 - I believe u can implement this library all by ur own to fix issue.

If thinks is related with the SameSite property. Google should make changes in its API, in the way they set cookies. In Google documentation in https://developers.google.com/identity/sign-in/web/build-button, the custom button also fails. So... I think it's a change that google should make.

Any news?

For those having this error in incognito mode:

{error: "idpiframe_initialization_failed", details: "Cookies are not enabled in current environment."}

This is actually caused by the browser blocking third party cookies, so you have to handle this error and/or display the user a proper explanation on how to allow them.

On Chrome by clicking the eye showing up in the address bar, you should be able to toggle that after clicking the text in blue:

 blocked3pc

@exanders This is indeed my problem. However, I think I will be looking for a way to do the authentication on the backend instead using OAuth 2.0 for Web Server Applications

"If many of your users have this feature enabled (some companies enforce this setting for all their employees), another workaround is to implement a server-side OAuth 2.0 flow."

https://developers.google.com/identity/sign-in/web/troubleshooting

I also find this StackOverflow answer useful to support my approach.

just to clarify this for anyone reading this thread. the google API absolutely does not support chrome running in incognito mode. Its being tracked here. If you need to support incognito then you need to do this on the backend as @abbathaw mentioned above.

I believe this issue has been resolved.
Firefox, Chromium, Chrome, Opera Those are the browsers I have tested.

Any updates on this?
Apple seems to blocking third party cookies by default now too: https://webkit.org/blog/10218/full-third-party-cookie-blocking-and-more/. It seems like a big deal to find a workaround that isn't replacing all client-side auth.

Same issue, any updates?

image

To fix this issue in Google we need to go to Settings....Search for cookies and then as shown in the photo enable third-party cookies in incognito mode.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bradeac picture bradeac  路  4Comments

pogran picture pogran  路  4Comments

rishipr picture rishipr  路  7Comments

anthonyjgrove picture anthonyjgrove  路  8Comments

pulkit-max picture pulkit-max  路  8Comments