Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Credentials JWT, auth flow for useGoogleLogin hook #348

Open
oobohP opened this issue May 8, 2024 · 2 comments
Open

Credentials JWT, auth flow for useGoogleLogin hook #348

oobohP opened this issue May 8, 2024 · 2 comments

Comments

@oobohP
Copy link

oobohP commented May 8, 2024

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>
    ```
@deepakbytebard
Copy link

most awaited component prop

@jbarop
Copy link

jbarop commented Jan 17, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants