add debug output for google id

This commit is contained in:
AJ ONeal 2020-08-20 05:49:46 +00:00
parent e7c21aa35c
commit 673671147c
1 changed files with 27 additions and 0 deletions

View File

@ -1,5 +1,12 @@
<html> <html>
<head> <head>
<meta name="google-signin-scope" content="email">
<meta
name="google-signin-client_id"
content="291138637698-9hjbgadgkibuv9j26104aj0bg5bia30j.apps.googleusercontent.com"
/>
<style> <style>
@media (prefers-color-scheme: dark) { @media (prefers-color-scheme: dark) {
body { body {
@ -134,5 +141,25 @@ You shouldn't use it for automated testing, because it will change, but it looks
</code></pre> </code></pre>
</div> </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> </body>
</html> </html>