Is it possible to consume that API from jquery? If I could do it but from PHP, when doing a post like that in jquery:
$.post("https://www.googleapis.com/youtube/v3/videos?id=VO7wstoK_gI&key=AIzaSyDolRu-zJQdK38G52I_rdxqRqruHx2PSBc&part=snippet,contentDetails,statistics,status",
function (respuesta) {
alert(respuesta);
}).fail(function(p) {
alert(JSON.stringify(p));
});
I do not throw anything, it is clear that I already have the API key and if I could consume it from the backend, I previously consulted a weather API from jquery, so I think it could.
In the alert of the error function I get this:
{"readyState":4,"responseText":"{\n \"error\": {\n \"errors\": [\n {\n \"domain\": \"global\",\n \"reason\": \"required\",\n \"message\": \"Login Required\",\n \"locationType\": \"header\",\n \"location\": \"Authorization\"\n }\n ],\n \"code\": 401,\n \"message\": \"Login Required\"\n }\n}\n","responseJSON":{"error":{"errors":[{"domain":"global","reason":"required","message":"Login Required","locationType":"header","location":"Authorization"}],"code":401,"message":"Login Required"}},"status":401,"statusText":"Unauthorized"}