From offical google contact api docs:
Deleting contacts
To delete a contact, send an authorized DELETE request to the contact's edit URL.
The URL is of the form:
https://www.google.com/m8/feeds/contacts/{userEmail}/full/{contactId}
simple request to delete returns 401 error
as response.
var url = "https://www.google.com/m8/feeds/contacts/"+req.token.body.sub.agent.agentId+"/full/"+result.googleId;
unirest.delete(url)
.header({
'Authorization': 'accessToken='+req.token,
'If-Match': '*',
})
.timeout(60000)
.end(function (res1) {
console.log('delete success... ', res1);
res.send(res1);
});
Note: I tried with 'Authorization': 'Bearer '+req.token,
as well but still the same issue
Fixed it. The problem was with the access Token
(req.token)
I was sending. I was sending object instead of actual token string