I have this code for accessing Google Contacts API using firebase. It authenticates the user and returns the access_token but it does not seem to work accessing the Contacts API(I am using AngularFire). Here is the code:
var ref = new Firebase("<<FIREBASE-APP>>");
$scope.click = function() {
ref.authWithOAuthPopup("google", function (error, authData) {
if (error) {
console.log("Login Failed!", error);
} else {
console.log("Authenticated successfully with payload:", authData);
console.log(authData.google.accessToken);
var resource = "https://www.google.com/m8/feeds/contacts/default/full?alt=json&access_token=" + authData.google.accessToken;
$.getJSON(resource,function (response) {
console.log(resource);
});
}
The error received is: https://www.google.com/m8/feeds/contacts/default/full?alt=json&access_token… 401 (OK)
Here is the format of authData received:
-auth
-provider
-uid
-expires
-google
-accessToken
-displayName
-id
-cacheduserprofile
-provider
-token
-uid