How the use google sign in javascript

PHOTO EMBED

Wed Aug 09 2023 14:39:03 GMT+0000 (Coordinated Universal Time)

Saved by @Himanshu007 #javascript

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="google-signin-client_id"
        content="CLIENT_ID">
    <title>Google Auth</title>
</head>

<body>
    <button onclick="signIn()"> SignIn with Google</button>
    <script src="https://accounts.google.com/gsi/client" async></script>
    <script src="https://apis.google.com/js/platform.js" async defer></script>
    <script>
        let signIn = function () {
            console.log("Windows Loaded")
            google.accounts.id.initialize({
                client_id: 'CLIENT_ID',
                callback: handleCredentialResponse
            });
            google.accounts.id.prompt();
        };
        function handleCredentialResponse(res) {
            console.log("Response : ");
            console.log(res);
        }
    </script>
</body>

</html>
content_copyCOPY