I just started my first meteor project, and I'm trying to access the youtube API.
I created the developer credentials using google and I enabled the ui accounts and percolation of the google-api packages. I can successfully log in with accounts-ui, which means that my OAuth settings work.
Then I try to run something like this on the client:
GoogleApi.get('youtube/v3/search',{
part : 'snippet',
q : 'cats',
maxResults : 25
},
function(err,data) {
!err ? console.log(data) : console.log(err);
});
And I get the following error on the console:
Error: failed [403] { "error": { "errors": [ { "domain": "global", "reason": "insufficientPermissions", "message": "Insufficient Permission" } ], "code": 403, "message": "Insufficient Permission" } }
I’m not sure if I call the function incorrectly, since I can’t find examples of using the GoogleApi.get () function (and I am a beginning meteorite), or my developer account is not configured correctly, or what.
Any help or pointers you can go through is greatly appreciated. Thank!
:
FullStack , :
var url = "https://www.googleapis.com/youtube/v3/search";
var params = {
key: {Google API Key}
part: "snippet",
q: searchTerm,
maxResults: 25
};
Meteor.http.get(url, {params: params}, function (err, result) {
console.log(result.statusCode, result.data);
var retdata = result.data;
Session.set("youtubeSearchItems", retdata.items);
});