Skip to content

Commit

Permalink
added OneTapGoogleLogin
Browse files Browse the repository at this point in the history
  • Loading branch information
Vyom-V committed Jul 3, 2023
1 parent 97ce101 commit 4c9b42a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions linkup-frontend/src/Pages/SignupPage/SignupPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import googleicon from "../../Assets/google-icon.svg";
import SidebarImage from "../../Assets/SidebarImageSignup.jpg";
import { useNavigate } from "react-router-dom";
import { useGoogleLogin } from "@react-oauth/google";
import { useGoogleOneTapLogin } from '@react-oauth/google';
import axios from 'axios';
import Cookies from 'js-cookie';
import SimpleCrypto from 'simple-crypto-js';
Expand Down Expand Up @@ -91,6 +92,13 @@ export default function SignupPage() {
client_id: process.env.REACT_APP_CLIENT_ID,
onSuccess: response => loginsuccess(response),
});

const oneTapGooglelogin = useGoogleOneTapLogin({
client_id: process.env.REACT_APP_CLIENT_ID,
onSuccess: credentialResponse => {
loginsuccess(credentialResponse);
}
});

async function loginsuccess(response) {
try {
Expand Down Expand Up @@ -152,6 +160,10 @@ export default function SignupPage() {
continue with Google
<img src={googleicon} className="googleicon" alt="google-icon" />
</div>
<div className="google-signup-btn" onClick={oneTapGooglelogin}>
Quick Login
<img src={googleicon} className="googleicon" alt="google-icon" />
</div>
</div>
</div>
</>
Expand Down

0 comments on commit 4c9b42a

Please sign in to comment.