我正在使用:https ://github.com/aws-amplify/amplify-js
是否有任何工作示例如何使用经过身份验证的 AWS 访问?我正在使用这个:
Amplify.configure({
Auth: {
identityPoolId: configs.broker.identityPoolId,
region: configs.broker.aws_pubsub_region,
userPoolId: configs.broker.userPoolId,
userPoolWebClientId: configs.broker.userPoolWebClientId,
}
});
Amplify.addPluggable(new AWSIoTProvider(configs.broker));
Auth.signIn(configs.broker.username, configs.broker.password)
.then(user => {
resolve({ code: 200, message: 'Authorized access to AWS is used' })
})
.catch(singInErr => resolve({ code: 500, message: singInErr.message }));
如果没问题(没问题):
PubSub.publish(configs.broker.topic, JSON.stringify(data))
.then(res => resolve({
code: 200,
message: 'OK'
}))
.catch(err => resolve({
code: 500,
message: err.toString()
}));
但我不断得到:
[未处理的承诺拒绝:NotAuthorizedException:此身份池不支持未经身份验证的访问。]