Gsign In
5 years ago in Plain Text
<html lang="en">
<head>
<script src="https://apis.google.com/js/platform.js" async defer></script>
<meta name="google-signin-scope" content="profile email">
<meta name="google-signin-client_id" content="879271813273-4tvmll5r1cg4dt1t4kooll0fj6e4f4rl.apps.googleusercontent.com">
<script type="text/javascript" >
function onSignIn(googleUser) {
// Useful data for your client-side scripts:
var profile = googleUser.getBasicProfile();
console.log("ID: " + profile.getId()); // Don't send this directly to your server!
uname = profile.getName();
console.log('Given Name: ' + profile.getGivenName());
console.log('Family Name: ' + profile.getFamilyName());
uimage = profile.getImageUrl();
email = profile.getEmail();
// The ID token you need to pass to your backend:
var id_token = googleUser.getAuthResponse().id_token;
}
</script>
<!-- The core Firebase JS SDK is always required and must be listed first -->
<script src="https://www.gstatic.com/firebasejs/8.0.2/firebase-app.js"></script>
<!-- TODO: Add SDKs for Firebase products that you want to use
https://firebase.google.com/docs/web/setup#available-libraries -->
<script src="https://www.gstatic.com/firebasejs/8.0.2/firebase-analytics.js"></script>
<script>
// Your web app's Firebase configuration
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
var firebaseConfig = {
apiKey: "AIzaSyCfv61kC_4PPU4kFbX-Zwmh0Wl7rpcdZY0",
authDomain: "webchatapp-af069.firebaseapp.com",
databaseURL: "https://webchatapp-af069.firebaseio.com",
projectId: "webchatapp-af069",
storageBucket: "webchatapp-af069.appspot.com",
messagingSenderId: "879271813273",
appId: "1:879271813273:web:bc074cdc8ff0fd80db9808",
measurementId: "G-ZD83JHWTWG"
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
firebase.analytics();
</script>
</head>
<body>
<div class="g-signin2" data-onsuccess="onSignIn" data-theme="dark" id="value"></div>
<script>
function onSignIn(googleUser) {
// Useful data for your client-side scripts:
var profile = googleUser.getBasicProfile();
console.log("ID: " + profile.getId()); // Don't send this directly to your server!
uname = profile.getName();
console.log('Given Name: ' + profile.getGivenName());
console.log('Family Name: ' + profile.getFamilyName());
uimage = profile.getImageUrl();
email = profile.getEmail();
// The ID token you need to pass to your backend:
var id_token = googleUser.getAuthResponse().id_token;
console.log("ID Token: " + id_token);
document.getElementById('udata').innerHTML='Name :'+uname+' Email: '+email+ ' Image ' +"<img src='"+uimage+"'/>";
}
</script>
<button onclick="return signOut();">Sign out</button>
<script>
fvar revokeAllScopes = function() {
gapi.auth2.getAuthInstance().disconnect();
return false;
}
</script>
<div id = "udata">
<h1>DETAILS<h1>
</div>
<!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->
<!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->
<script src="/__/firebase/8.0.2/firebase-app.js"></script>
<script src="/__/firebase/8.0.2/firebase-database.js"></script>
<!-- If you enabled Analytics in your project, add the Firebase SDK for Analytics -->
<script src="/__/firebase/8.0.2/firebase-analytics.js"></script>
<!-- Add Firebase products that you want to use -->
<script src="/__/firebase/8.0.2/firebase-auth.js"></script>
<script src="/__/firebase/8.0.2/firebase-firestore.js"></script>
<script src="/__/firebase/init.js"></script>
</body>
</html>