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

Credentials JWT, auth flow for useGoogleLogin hook

Open oobohP opened this issue 1 year ago • 2 comments

Do you think it would be possible to add a optional refs to your GoogleLogin component which flow gives the JWT token

allowing very similar behavior, we can hide the button that is iframed by google, put our own custom button on top and use that when the user clicks our div/button it will give the illusion that our button is the Login with google

this would reduce the overhead needed to call additional apis or exchange auth code's with google on the backend

it would look something like this

    <div>
      <div style={{ display: "none" }}>
        <GoogleLogin
          ref={googleLoginBtnRef}
          onSuccess={credentialResponse => {
            console.log(credentialResponse);
            // Handle authentication success
          }}
          onError={() => {
            console.log("Login Failed");
            // Handle login error
          }}
        />
      </div>

      <StyledNormalButton
        onClick={onCustomButtonClick} // Trigger Google login when your custom button is clicked
        role='link'
        label={label}
        variant='rounded-outlined'
        type='button'
        leftIcon={
          <Image
            width={32}
            height={32}
            src={`${basePath}/assets/images/google-login.svg`}
            alt={label}
          />
        }
      />
    </div>
    ```

oobohP avatar May 08 '24 00:05 oobohP

most awaited component prop

deepakbytebard avatar Aug 01 '24 07:08 deepakbytebard

This will not work because the browser prevents access to the iframe's content due to the cross-domain policy.

jbarop avatar Jan 17 '25 08:01 jbarop