JSFiddle - React, Tailwind, and code Playground
by KomathiKarunakaran
HTML
<html>
<head>
<meta name="google-signin-client_id" content="701034559310-mtt97tclmg4pbaed3pubucudve6aopiq.apps.googleusercontent.com">
<script src="https://apis.google.com/js/platform.js?onload=renderButton" async defer></script>
</head>
<body>
<div id="my-signin2" data-width="300" data-height="200" data-longtitle="true"></div>
</body>
</html>
JavaScript
function onSuccess(googleUser) {
console.log('Logged in as: ' + googleUser.getBasicProfile().getName());
}
function onFailure(error) {
console.log(error);
}
function renderButton() {
gapi.signin2.render('my-signin2', {
'scope': 'profile email',
'width': 240,
'height': 50,
'longtitle': true,
'theme': 'dark',
'onsuccess': onSuccess,
'onfailure': onFailure
});
}