blob: 744f7d274c46e7ceb64dbe41922674a008728b90 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
<script src="https://apis.google.com/js/platform.js" async defer></script>
<meta name="google-signin-client_id" content="561588943542-fq7065hk47qdf3lfsc50ebll4spi6u76.apps.googleusercontent.com">
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/socket.io/1.3.6/socket.io.min.js"></script>
<script>
function onSignIn(googleUser) {
var id_token = googleUser.getAuthResponse().id_token;
var socket = io.connect('http://' + document.domain + ':' + location.port);
socket.on('connect', function() {
socket.emit('request', {
id: 234,
path: "/v1/simulations/{simulationId}",
method: "GET",
parameters: {
body: {
},
path: {
simulationId: 1
},
query: {
email:'l.overweel@gmail.com'
}
},
token: id_token
});
})
socket.on('response', function(response) {
console.log(JSON.parse(response));
});
}
</script>
<script>
function signOut() {
var auth2 = gapi.auth2.getAuthInstance();
auth2.signOut().then(function () {
console.log('User signed out.');
});
}
</script>
<div class="g-signin2" data-onsuccess="onSignIn"></div>
<a href="#" onclick="signOut();">Sign out</a>
|