【发布时间】:2016-11-30 04:23:24
【问题描述】:
我已将 AWS API Gateway 与 AWS Cognito 用户池集成。以下 curl 命令有效。
curl -X PUT -H "Authorization:<id token>" -d <json data> <https url>
但是,以下 Angularjs $http.put 授权失败。 AWS cloudwatch 日志显示“用户未经授权”
$http.defaults.headers.common['Authorization'] = token
$http.put('https://<url>', <json data> )
.then(function (data, status, headers, config) {
console.log('success')
}, function (data, status, headers, config) {
console.log('failure')
});
授权令牌应该如何用$http.put设置?
【问题讨论】:
标签: angularjs amazon-web-services curl aws-api-gateway