Browse Source

add debug output for google id

master
AJ ONeal 4 years ago
parent
commit
673671147c
  1. 27
      public/index.html

27
public/index.html

@ -1,5 +1,12 @@
<html>
<head>
<meta name="google-signin-scope" content="email">
<meta
name="google-signin-client_id"
content="291138637698-9hjbgadgkibuv9j26104aj0bg5bia30j.apps.googleusercontent.com"
/>
<style>
@media (prefers-color-scheme: dark) {
body {
@ -134,5 +141,25 @@ You shouldn't use it for automated testing, because it will change, but it looks
</code></pre>
</div>
<div class="g-signin2" data-scope="email" data-onsuccess="onSignIn" data-theme="dark"></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!
console.log('Full Name: ' + profile.getName());
console.log('Given Name: ' + profile.getGivenName());
console.log('Family Name: ' + profile.getFamilyName());
console.log("Image URL: " + profile.getImageUrl());
console.log("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);
}
</script>
<script src="https://apis.google.com/js/platform.js" async defer></script>
</body>
</html>

Loading…
Cancel
Save