about summary refs log tree commit diff
path: root/client/index.html
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2020-07-29T09·13+0100
committerWilliam Carroll <wpcarro@gmail.com>2020-07-29T09·13+0100
commit9f70cb2c612212e218b5df75c9afba08f51d3acb (patch)
tree7deffbd2f6328671f9de879bef4e273a22c2a5d2 /client/index.html
parent289cae2528946aa5d745e904cdaaec7df1a71493 (diff)
Add boilerplate for Google sign-in
For more information, read:
https://developers.google.com/identity/sign-in/web/sign-in?authuser=1

TODO: Use Elm ports or something similar to properly interop with the onSignIn
and signOn functions defined in index.html.
Diffstat (limited to 'client/index.html')
-rw-r--r--client/index.html18
1 files changed, 18 insertions, 0 deletions
diff --git a/client/index.html b/client/index.html
index ce8f727b6f3b..facf4e98623c 100644
--- a/client/index.html
+++ b/client/index.html
@@ -2,13 +2,31 @@
 <html lang="en">
   <head>
     <meta charset="UTF-8" />
+    <meta name="google-signin-client_id" content="580018768696-4beppspj6cu7rhjnfgok8lbmh9a4n3ok.apps.googleusercontent.com">
     <title>Elm SPA</title>
     <link rel="stylesheet" href="./output.css" />
+    <script src="https://apis.google.com/js/platform.js" async defer></script>
     <script src="./Main.min.js"></script>
   </head>
   <body class="font-serif">
     <div id="mount"></div>
     <script>
+     function onSignIn(googleUser) {
+       var profile = googleUser.getBasicProfile();
+       console.log('ID: ' + profile.getId());
+       console.log('Name: ' + profile.getName());
+       console.log('Image URL: ' + profile.getImageUrl());
+       console.log('Email: ' + profile.getEmail());
+     }
+
+     function signOut() {
+       console.log('Signing out!');
+       var auth2 = gapi.auth2.getAuthInstance();
+       auth2.signOut().then(function() {
+         console.log('User signed out.');
+       });
+     }
+
      Elm.Main.init({node: document.getElementById("mount")});
     </script>
   </body>