diff --git a/Guide/oauth.markdown b/Guide/oauth.markdown
index 1c7e17694..d208a0ed7 100644
--- a/Guide/oauth.markdown
+++ b/Guide/oauth.markdown
@@ -209,35 +209,41 @@ instance View (NewView User) where
loginWithGoogle :: Html
loginWithGoogle = [hsx|
-
- Continue with Google
-
+
+
+
+
+
-
-
+
+
|]
+ where
+ googleClientId :: Text = "YOUR GOOGLE CLIENT ID"
```
The login process uses the Google Login JS SDK and requires a little bit of JavaScript to work. Create a file `static/google-login.js` with this content:
```javascript
-function initGoogleLogin() {
- gapi.load('auth2', function() {
- var element = document.getElementById('continue-with-google');
- var clientId = element.dataset.clientId;
- auth2 = gapi.auth2.init({ client_id: clientId, scope: 'profile' });
-
- auth2.attachClickHandler(element, {},
- function(googleUser) {
- var form = document.getElementById('new-session-with-google-form');
- form.querySelector('input[name="jwt"]').value = googleUser.getAuthResponse().id_token;
- form.submit();
- }, function(error) {
- alert(JSON.stringify(error, undefined, 2));
- });
- });
+function onGoogleLogin(response) {
+ var form = document.getElementById('new-session-with-google-form');
+ form.querySelector('input[name="jwt"]').value = response.credential;
+ form.submit();
}
```