<!DOCTYPE html>
<html>
<head>
<script src="https://www.gstatic.com/firebasejs/3.7.1/firebase.js"></script>
<script
src="https://code.jquery.com/jquery-3.2.1.js"
integrity="sha256-DZAnKJ/6XZ9si04Hgrsxu/8s717jcIzLy3oi35EouyE="
crossorigin="anonymous"></script>
<link rel="stylesheet" href="style.css" />
<script src="script.js"></script>
</head>
<body>
<button onclick="login()">Login to Google</button>
<script>
var config = {
apiKey: "AIzaSyDgI_Y6e7ShbY0p6F5TyGbdwwGFmZyQETw",
authDomain: "test-21739.firebaseapp.com",
databaseURL: "https://test-21739.firebaseio.com",
storageBucket: "test-21739.appspot.com",
messagingSenderId: "1090425677940"
};
firebase.initializeApp(config);
function login(){
// Start a sign in process for an unauthenticated user.
var provider = new firebase.auth.GoogleAuthProvider();
provider.addScope('profile');
provider.addScope('email');
provider.addScope('https://www.googleapis.com/auth/contacts');
provider.addScope('https://www.googleapis.com/auth/contacts.readonly');
provider.addScope('https://www.googleapis.com/auth/plus.login');
firebase.auth().signInWithPopup(provider).then(function(result) {
// This gives you a Google Access Token. You can use it to access the Google API.
var token = result.credential.accessToken;
// The signed-in user info.
var user = result.user;
$.get('https://people.googleapis.com/v1/people/me/connections?access_token=' + token, function(data){
console.log(data);
});
}).catch(function(error) {
// Handle Errors here.
var errorCode = error.code;
var errorMessage = error.message;
// The email of the user's account used.
var email = error.email;
// The firebase.auth.AuthCredential type that was used.
var credential = error.credential;
// ...
});
}
</script>
</body>
</html>
// Code goes here
/* Styles go here */