Advertisement
contatowellington

Untitled

Mar 24th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. Fonte https://developers.google.com/identity/sign-in/web/
  2.  
  3. <html lang="en">
  4. <head>
  5. <meta name="google-signin-scope" content="profile email">
  6. <meta name="google-signin-client_id" content="YOUR_CLIENT_ID.apps.googleusercontent.com">
  7. <script src="https://apis.google.com/js/platform.js" async defer></script>
  8. </head>
  9. <body>
  10. <div class="g-signin2" data-onsuccess="onSignIn" data-theme="dark"></div>
  11. <script>
  12. function onSignIn(googleUser) {
  13. // Useful data for your client-side scripts:
  14. var profile = googleUser.getBasicProfile();
  15. console.log("ID: " + profile.getId()); // Don't send this directly to your server!
  16. console.log('Full Name: ' + profile.getName());
  17. console.log('Given Name: ' + profile.getGivenName());
  18. console.log('Family Name: ' + profile.getFamilyName());
  19. console.log("Image URL: " + profile.getImageUrl());
  20. console.log("Email: " + profile.getEmail());
  21.  
  22. // The ID token you need to pass to your backend:
  23. var id_token = googleUser.getAuthResponse().id_token;
  24. console.log("ID Token: " + id_token);
  25. }
  26. </script>
  27. </body>
  28. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement