Advertisement
MarkUa

log in/out with gmail

Feb 20th, 2019
1,033
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 1.10 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.     <meta charset="UTF-8" name="google-signin-client_id" content="503693956193-qaq9k02vibebr4la22ta1ggsutbmj5ts.apps.googleusercontent.com">
  5.     <title>Title</title>
  6.     <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
  7.     <script src="https://apis.google.com/js/platform.js" async defer></script>
  8.  
  9. </head>
  10. <body>
  11. <div class="g-signin2" data-onsuccess="onSignIn"></div>
  12. <a href="#" onclick="signOut()">Sign out</a>
  13. <script>
  14.     function onSignIn(googleUser) {
  15.         alert('fwef')
  16.   var profile = googleUser.getBasicProfile();
  17.   alert('ID: ' + profile.getId()); // Do not send to your backend! Use an ID token instead.
  18.   alert('Name: ' + profile.getName());
  19.   alert('Image URL: ' + profile.getImageUrl());
  20.   alert('Email: ' + profile.getEmail()); // This is null if the 'email' scope is not present.
  21.  
  22.     }
  23.  
  24.      function signOut() {
  25.          alert('1')
  26.     var auth2 = gapi.auth2.getAuthInstance();
  27.          alert(2)
  28.     auth2.signOut().then(function () {
  29.       alert('User signed out.');
  30.     });
  31.   }
  32.  
  33. </script>
  34.  
  35. </body>
  36. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement