I really hate to beat this dead horse, but I couldn't find a clear answer using node without using node-oauth. After receiving a user's access token in the Oauth dance from Passport, I can't seem to actually perform a successful GET:
function(accessToken, callback)
{
var request = require('https').request(
{
host: 'www.google.com',
port: 443,
path: '/m8/feeds/contacts/default/full?alt=json',
method: 'GET',
headers:
{
Authorization: 'Oauth ' + accessToken
}
},
function (res)
{
console.log(res.statusCode);
callback(JSON.parse(res));
});
request.end();
}
I get a 401. I know the accessToken is valid. I'm using the headers the exact same way I saw them in Google's Oauth Playground. Thanks so much for your help!
Kill me now:
Wrong:
Authorization: 'Oauth ' + accessToken
Right:
Authorization: 'OAuth ' + accessToken