Created
September 23, 2015 01:59
-
-
Save twhite96/ec30aa07a1a039ef3927 to your computer and use it in GitHub Desktop.
Google Contacts API v3 Javascript sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script src="https://apis.google.com/js/client.js"></script> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script> | |
<script> | |
function auth() { | |
var config = { | |
'client_id': 'OAUTH_CLIENT_ID', | |
'scope': 'https://www.google.com/m8/feeds' | |
}; | |
gapi.auth.authorize(config, function() { | |
fetch(gapi.auth.getToken()); | |
}); | |
} | |
function fetch(token) { | |
$.ajax({ | |
url: 'https://www.google.com/m8/feeds/contacts/default/full?alt=json', | |
dataType: 'jsonp', | |
data: token | |
}).done(function(data) { | |
console.log(JSON.stringify(data)); | |
}); | |
} | |
</script> | |
</head> | |
<body> | |
<button onclick="auth();">GET CONTACTS FEED</button> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment