我正在使用auth令牌进行身份验证,一切都很好,我有auth令牌,我使用sessionStorage存储并将其携带到标头,但它始终显示以下错误
GET http://someurl.com/services/api/ts?call…y214052125942427665_1438618929218&q=&sort=&sd=&skip=&take=&_=1438618929219 401 (Unauthorized)
jQuery代码
getAllData = function () {
var qData = { q: '', sort: '', sd: '', skip: '', take: '' };
return $.ajax({
url: 'http://someurl.com/services/api/ts', // dummy url
type: "GET",
cache: false,
dataType: 'jsonp',
headers: {
'Authorization': "bearer " + sessionStorage.getItem('authToken')
},
data: qData,
success: function (data) {
console.log(data);
},
error: function (err) {
console.log(err.statusText);
}
});
}