SHOW:
|
|
- or go back to the newest paste.
1 | <!DOCTYPE html> | |
2 | <html> | |
3 | <head> | |
4 | <meta charset="utf-8"> | |
5 | <title>Google-Signin</title> | |
6 | <meta name="google-signin-client_id" content="__client_id_____.apps.googleusercontent.com"> | |
7 | <script | |
8 | src="https://code.jquery.com/jquery-3.2.1.min.js" | |
9 | integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" | |
10 | crossorigin="anonymous"></script> | |
11 | <script src="https://apis.google.com/js/platform.js" async defer></script> | |
12 | - | </style> |
12 | + | |
13 | <body> | |
14 | ||
15 | <div class="g-signin2" data-onsuccess="onSignIn"></div> | |
16 | ||
17 | <script type="text/javascript"> | |
18 | function onSignIn(googleUser) { | |
19 | var profile = googleUser.getBasicProfile(); | |
20 | console.log('ID: ' + profile.getId()); // Do not send to your backend! Use an ID token instead. | |
21 | console.log('Name: ' + profile.getName()); | |
22 | console.log('Image URL: ' + profile.getImageUrl()); | |
23 | console.log('Email: ' + profile.getEmail()); // This is null if the 'email' scope is not present. | |
24 | ||
25 | var email = profile.getEmail(); | |
26 | alert(email); | |
27 | ||
28 | } | |
29 | </script> | |
30 | ||
31 | </body> | |
32 | </html> |