<script src="https://accounts.google.com/gsi/client"></script>
...
declare var google: any;
...
useEffect(() => {
const handleCredentialResponse = (response: any) => {
console.log(response);
};
const client_id = process.env.REACT_APP_GOOGLE_CLIENT_ID;
const callback = handleCredentialResponse;
const auto_select = true;
google.accounts.id.initialize({ client_id, callback, auto_select });
google.accounts.id.prompt((notification: any) => {
console.log(notification);
});
}, []);
Why does handleCredentialResponse
not get called at all? The user is prompted to log in, they hit continue and then the function never gets called! Grrr! Above taken from docs here and also here
The notification
logs out
nl {g: "display", h: true}
nl {g: "skipped", l: "issuing_failed"}
are you testing locally? As mentioned here, you need to add both http://localhost and http://localhost:port_number to the Authorized JavaScript origins box.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With