【发布时间】:2018-09-24 05:23:22
【问题描述】:
我正在尝试使用适用于 React Native 的 AWS Amplify SDK 和 API Gateway 中的 IAM 授权器发出一个简单的获取请求。我总是收到以下错误消息:
凭据的范围应为有效区域,而不是“us-east-1”。
我做错了什么?这是我的代码(还没有做任何事情):
function getImageIdForUpload() {
let apiName = 'MyAPIGatewayAPI';
let path = '/upload-image/get-new-id';
let myInit = {
// replace this with attributes you need
};
API.get(apiName, path, myInit).then(response => {
console.log(response)
}).catch(error => {
console.error(error.response)
});
}
我的配置:
Auth: {
// REQUIRED - Amazon Cognito Identity Pool ID
identityPoolId: 'eu-central-1:xxxx',
// REQUIRED - Amazon Cognito Region
region: 'eu-central-1',
// OPTIONAL - Amazon Cognito User Pool ID
userPoolId: 'eu-central-1_xxxx',
// OPTIONAL - Amazon Cognito Web Client ID
userPoolWebClientId: 'xxxx',
},
任何帮助将不胜感激:)
【问题讨论】:
标签: amazon-web-services react-native aws-api-gateway amazon-iam aws-amplify