1<html lang="en">
2 <head>
3 <meta name="google-signin-scope" content="profile email">
4 <meta name="google-signin-client_id" content="YOUR_CLIENT_ID.apps.googleusercontent.com">
5 <script src="https://apis.google.com/js/platform.js" async defer></script>
6 </head>
7 <body>
8 <div class="g-signin2" data-onsuccess="onSignIn" data-theme="dark"></div>
9 <script>
10 function onSignIn(googleUser) {
11 // Useful data for your client-side scripts:
12 var profile = googleUser.getBasicProfile();
13 console.log("ID: " + profile.getId()); // Don't send this directly to your server!
14 console.log('Full Name: ' + profile.getName());
15 console.log('Given Name: ' + profile.getGivenName());
16 console.log('Family Name: ' + profile.getFamilyName());
17 console.log("Image URL: " + profile.getImageUrl());
18 console.log("Email: " + profile.getEmail());
19
20 // The ID token you need to pass to your backend:
21 var id_token = googleUser.getAuthResponse().id_token;
22 console.log("ID Token: " + id_token);
23 }
24 </script>
25 </body>
26</html>