【发布时间】:2015-08-27 17:51:10
【问题描述】:
我相信我正确地包含了我的访问令牌,所以我有点困惑为什么我仍然收到来自https://www.api.imgur.com/3/album 的Permission Denied 响应。请参阅下面的代码:
$http.get('https://api.imgur.com/oauth2/authorize?client_id=MY_CLIENT_ID&response_type=token').then(function(json){
console.log(json);
$scope.token = json.config.headers.Authorization;
$http({
url: 'https://api.imgur.com/3/album/rX8ws',
Authorization: $scope.token,
type: 'GET'
})
})
任何帮助将不胜感激。
最好的问候,
彼得
=============更新====================
调整了我的请求,将授权密钥封装在 headers 中,如下所示:
$http.get('https://api.imgur.com/oauth2/authorize?client_id=117ab4fd3e5fb89&response_type=token').then(function(json){
console.log(json);
$scope.token = json.config.headers.Authorization;
$http({
url: 'https://api.imgur.com/3/album/rX8ws',
headers: {
Authorization: $scope.token, //added token in headers
},
type: 'GET'
})
})
仍然收到403 Permission Denied
=============Update-2===================
尝试将 type: 'GET' 更改为 method: 'GET' 无济于事。仍然返回403 (Permission Denied)
【问题讨论】:
标签: angularjs api get authorization imgur