react-oauth icon indicating copy to clipboard operation
react-oauth copied to clipboard

Adopting FedCM regarding Chrome blocking third party cookies in future. Seeing warnings: Chrome will block third party cookies

Open rjtbansal opened this issue 1 year ago • 11 comments

Firstly thanks for this awesome library! I am using it for Google SSO on our web app.

Do we plan to make tweaks to the library for adopting FedCM https://developers.google.com/identity/gsi/web/guides/fedcm-migration?

Here's the Google docs that talk about third party cookies https://developers.google.com/identity/gsi/web/guides/supported-browsers#third-party_cookies

Here's the migration guide: https://developers.google.com/identity/gsi/web/guides/fedcm-migration#migrate_your_web_app

As an example below the screenshot I see when Google icon loads using this library: image

rjtbansal avatar Feb 22 '24 19:02 rjtbansal

I have also received an email from Google to migrate to the FedCM over my website. I am using this library for the Google sign-in, and One Tap Sign in feature.

MuhammadAakash avatar Mar 04 '24 04:03 MuhammadAakash

@MomenSherif I'm interested in contributing to this excellent library. Could you please guide me a little bit on how to address this current issue? And I'm unable to find any references on how to set up the project and contribute to it.

Thanks

MuhammadAakash avatar Mar 04 '24 05:03 MuhammadAakash

@rjtbansal @MuhammadAakash I think they have already integrated FedCM in the library in this PR: https://github.com/MomenSherif/react-oauth/pull/316

VaibhavTessell avatar Apr 09 '24 13:04 VaibhavTessell

<GoogleLogin
    clientId="CLIENT_ID"
    text="Sign in with Google"
    onSuccess={onSuccessHandler}
    onError={onFailureHandler}
    ux_mode="redirect"
    useOneTap
    auto_select

    // New Addition for FedCM integration
--> containerProps={{ allow: "identity-credentials-get" }}
--> use_fedcm_for_prompt

/>

After adding the containerProps and use_fedcm_for_prompt Google login started working with FedCM integration.

@rjtbansal @MuhammadAakash

VaibhavTessell avatar Apr 10 '24 04:04 VaibhavTessell

@VaibhavTessell This is great as I dont see those warnings anymore! Just for the knowledge if possible could you please share how did you identify containerProps to be the fix?

rjtbansal avatar Apr 29 '24 21:04 rjtbansal

how would i do this for the auth code flow, not seeing how to do that with GoogleLogin and don't see any props available for fedcm with useLogin

ssteuteville avatar May 07 '24 18:05 ssteuteville

<GoogleLogin
    clientId="CLIENT_ID"
    text="Sign in with Google"
    onSuccess={onSuccessHandler}
    onError={onFailureHandler}
    ux_mode="redirect"
    useOneTap
    auto_select

    // New Addition for FedCM integration
--> containerProps={{ allow: "identity-credentials-get" }}
--> use_fedcm_for_prompt

/>

After adding the containerProps and use_fedcm_for_prompt Google login started working with FedCM integration.

@rjtbansal @MuhammadAakash

maybe you know what to do with useGoogleLogin there are no such parameters

ArturSha avatar Feb 14 '25 15:02 ArturSha

@ssteuteville, @ArturSha any news on this ? I also use the useGoogleLogin function but see no option for use_fedCM on this function.

berghuis-rakuten avatar May 15 '25 05:05 berghuis-rakuten

@ssteuteville, @ArturSha any news on this ? I also use the useGoogleLogin function but see no option for use_fedCM on this function.

There's no news on this yet. I started using the GoogleLogin component instead of useGoogleLogin for now.

ArturSha avatar May 19 '25 04:05 ArturSha

@ArturSha I see, thank you for your confirmation. Hope they will soon add the parameter so we could actually test it. Could you perhaps tell me how it works differently from the custom useGoogleLogin function ? I am interested to see if i could use it instead as well.

berghuis-rakuten avatar May 20 '25 04:05 berghuis-rakuten

@ArturSha I see, thank you for your confirmation. Hope they will soon add the parameter so we could actually test it. Could you perhaps tell me how it works differently from the custom useGoogleLogin function ? I am interested to see if i could use it instead as well.

https://chatgpt.com/share/682c0cae-b944-800f-9e48-c39077a98c2b

const [loginWithGoogle] = useLoginWithGoogleMutation(); //rtk query

 const onSubmitGoogle = async (response: CredentialResponse) => {
    try {
      await loginWithGoogle({
        token: response.credential || '',
       }).unwrap()
     some extra code
    } catch (error) {
     some code
    }
  }

return (
 <GoogleLogin
          ux_mode="popup"
          onSuccess={(response) => onSubmitGoogle(response)}
          use_fedcm_for_prompt
          use_fedcm_for_button
          cancel_on_tap_outside
          useOneTap
          shape="circle"
          locale={i18n.language}
        />
)

ArturSha avatar May 20 '25 05:05 ArturSha