I am trying to make ajax call to blogger.com . The call retrives the data of the user . I am using this https://developers.google.com/blogger/docs/3.0/ as reference . The following is the ajax I wrote .
var getUserDetail = function(){
var url = "https://www.googleapis.com/blogger/v3/users/self";
$.ajax({
url: url,
type: 'GET',
beforeSend: function (request)
{
request.setRequestHeader("Authorization","oauth_token_I_got");
},
}).done(function(data) {
console.log(data)
},"json");
}
I get 401 error whenever I try to make the call
Further Trace of the error
{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Login Required",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Login Required"
}
}
Where am I mistake ? Thanks