[英]AWS Cognito Associated with Google as an Identity Provider Doesn't Work
I have a cognito user pool which is associated with an identity pool. 我有一个与身份池关联的Cognito用户池。 Cognito works fine, but when i added Google as an identity provider, i don't know how it is going to work.
Cognito可以正常工作,但是当我将Google添加为身份提供者时,我不知道它将如何工作。 I did all steps in the documentation.
我完成了文档中的所有步骤。
I mean when a user sign in on my website with Google. 我的意思是,当用户使用Google登录我的网站时。 I can get all Google credentials of the user, id_token, name, email and so on.
我可以获得用户的所有Google凭据,id_token,名称,电子邮件等。
In my api-gateway i need an Identity token for to pass ( method.request.header.Authorization
). 在我的api网关中,我需要一个身份令牌来传递(
method.request.header.Authorization
)。 But when i log in with Google, it generates an id_token which i can not use for my api-gateways. 但是,当我使用Google登录时,它会生成一个id_token,我无法将其用于我的api网关。
What i can do with this id_token is using signinCallback()
and getting AWS.config.credentials; 我可以使用
signinCallback()
操作是使用signinCallback()
并获取AWS.config.credentials;。 _identityId, sessionToken, accessKeyId, thus all webIdentityCredentials of the user. _identityId,sessionToken,accessKeyId,因此用户的所有webIdentityCredentials。 But i can do nothing with all these, since i need an id_token which is generated by Cognito.
但是我无法使用所有这些方法,因为我需要由Cognito生成的id_token。
function signinCallback() {
AWS.config.credentials = new AWS.CognitoIdentityCredentials({
IdentityPoolId: poolId,
Logins: {
'accounts.google.com': id_token }
});
AWS.config.region = 'eu-west-1';
// Obtain AWS credentials
AWS.config.credentials.get(function (err) {
if (err) {
console.log(err);
}
else {
console.log(AWS.config.credentials);
}
});
}
How can i generate a valid id_token with this credentials? 如何使用此凭证生成有效的id_token?
您必须使用google auth,并且该认知选项适用于“ google plus”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.