我找不到任何显示如何执行此操作的文档,因此我尽力弄明白(这不是常见的用例)吗?我已经设置了我的资源以使用IAM身份验证,设置CORS等.然后我部署了它,并下载了生成的SDK.
在客户端,我使用AWS.CognitoIdentityCredentials中的凭据和apigClientFactory.newClient.当我尝试发布到我的资源时,我收到403错误响应,没有正文.
响应标头包含: x-amz-ErrorType: UnrecognizedClientException
这个错误可能来自其他一些AWS服务(它们会像那样冒泡)吗?如果是这样,我怎么知道哪一个?还有什么可能导致错误?
我正在使用测试测试客户端的代码如下所示:
function onFacebookLogin(fbtoken) {
// get cognito credentials
AWS.config.credentials = new AWS.CognitoIdentityCredentials({
IdentityPoolId: 'us-east-1:abcd6789-1234-567a-b123-12ab34cd56ef',
Logins: {'graph.facebook.com': fbtoken}
});
AWS.config.credentials.get(function(err) {
if (err) {return console.error('Credentials error: ', err);}
/* I'm assuming that this is what I use for accessKey and secretKey */
var credentials = AWS.config.credentials;
apigClient = apigClientFactory.newClient({
accessKey: credentials.accessKeyId,
secretKey: credentials.secretAccessKey
});
});
}
Run Code Online (Sandbox Code Playgroud) javascript amazon-web-services amazon-cognito aws-lambda aws-api-gateway
我试图从其他客户端测试经过身份验证的API网关端点.如何在发出请求时生成/设置"AWS_IAM"授权标头?
我想使用Cognito Federated Entity(允许通过Google登录等),允许访问用于web javascript应用程序的API Gateway.我设法通过与Google签约获得了Cognito的sessionToken,但我坚持使用API网关配置来启用会话令牌.
这个整个联合实体身份验证工作流程是否有一个很好的教程?
谢谢!
javascript federated-identity amazon-web-services amazon-cognito aws-api-gateway