dimanche 8 mars 2015

Youtube API Login Required

Using nodejs, I try something as simple as what's below and get the output:



{ [Error: Login Required] code: 401 }
null


The tutorials regarding the youtube api I've seen online all use youtube.discover('youtube','v3').execute() but that method no longer exists. What's wrong with my authentication? I just want to interact with youtube, server to server.



var gapi = require('googleapis');
var jwt = new gapi.auth.JWT(
'___email___',
'./key.pem',
null,
[
'http://ift.tt/1e5P8Hx'
],
null
);
jwt.authorize(function(err,result) {
var youtube = gapi.youtube({ version: 'v3', auth: result.access_token });
var params = {
id: 'JiPkDbjbN8w',
rating: 'like'
}
youtube.videos.rate(params,function(err,result) {
console.log(err);
console.log(result);
});
});

Aucun commentaire:

Enregistrer un commentaire