-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
50 lines (48 loc) · 1.8 KB
/
index.html
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
47
48
49
50
<html>
<body>
<button onclick="logIn()">Login With Facebook</button>
<script>
var person = {userID: "", name : "", accessToken:"",picture:""};
function logIn() {
FB.login(function(response) {
if(response.status == "connected"){
person.accessToken = response.authResponse.accessToken;
person.userID = response.authResponse.userID;
FB.api('/me?fields=id,name,picture.type(large)',function(userData) {
person.name = userData.name;
person.picture= userData.picture.data.url;
});
}
}, {scope: 'public_profile'})
}
window.fbAsyncInit = function() {
FB.init({
appId : '578881399229257',
autoLogAppEvents : true,
xfbml : true,
version : 'v3.2'
});
};
(function(d, s, id){
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "https://connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<script src="https://apis.google.com/js/platform.js" async defer>
</script>
<meta name="google-signin-client_id" content="20375758303-e26s8vk7jefv8ulvu7p3pireoi1s4uqc.apps.googleusercontent.com">
<div class="g-signin2" data-onsuccess="onSignIn"></div>
<script type="text/javascript">
function onSignIn(googleUser) {
var profile = googleUser.getBasicProfile();
console.log('ID: ' + profile.getId()); // Do not send to your backend! Use an ID token instead.
console.log('Name: ' + profile.getName());
console.log('Image URL: ' + profile.getImageUrl());
console.log('Email: ' + profile.getEmail()); // This is null if the 'email' scope is not present.
}
</script>
</body>
</html>