Sunday 28 May 2017

How to get Gmail contacts using Node.js / Javascript

Once I authorize using Auth0 I get the following data:

{ "accessToken": "XFTqiiAGJBn3IIeh", "idToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL2NwZXJyeTE4NDguYXV0aDAuY29tLyIsInN1YiI6Imdvb2dsZS1vYXV0aDJ8MTA4MTA5NjMzMjM3NTg1ODU4MTE4IiwiYXVkIjoiWkk3ZjVEaXp2VnBGbG1uVFRWSDlwbUc4T2h3S1l5ZVYiLCJleHAiOjE0OTU5MzE5MzcsImlhdCI6MTQ5NTg5NTkzN30.0umkkSiCoJCoIZcjLen89-uyxOE_nhLnyelL5UNKcFA", "idTokenPayload": { "iss": "https://XXX.auth0.com/", "sub": "google-oauth2|108109633237585858118", "aud": "ZI7f5DizvVpFlmnTTVH9pmG8OhwKYyeV", "exp": 1495931937, "iat": 1495895937 }, "state": "9FzPddU6_ov5~T2w2foNeZLsXB0miAoI" }

Then I send a GET request to https://www.google.com/m8/feeds/contacts/default/full?alt=json&v=3.0&access_token=XFTqiiAGJBn3IIeh. In the response I get a HTML with 401 status and the following message:

That's an error. There was an error in your request. That's all we know."

What am I doing wrong? Do you have a working example getting Gmail contacts?



via Alexander Elgin

No comments:

Post a Comment