AWS Cognito Google 身份提供商获取个人资料名字和姓氏

Tob*_*ias 2 google-authentication amazon-web-services amazon-cognito

我已经使用 Google 身份提供商设置了 AWS Cognito,如https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-social-idp.html 中所述

用户可以登录,但我似乎只取回用户emailemail_verifiedusername喜欢Google_xxxxxxxxxxxxxxx我的身份验证的回调和cognito登录/注册LAMBDA挂钩。

有没有办法同时获取用户的名字和姓氏?

我已经设置profile email openid为授权范围。

还尝试使用googleapisnpm 包进行调用,oauth2.userinfo.getHow to use the node google client api to get user profile with already fetched token? 但是我取回的访问令牌来自 Cogntio 而不是 google,这就是为什么我认为这对我不起作用。

F_S*_*O_K 6

我没有试过这个,但我知道这个理论。

在 Cognito 中,转到联邦 -> 属性映射 -> 从选项卡中选择 Google -> 检查 given_name 并将其映射到 Given Name,检查 family_name 并将其映射到 Family Name。

编辑:此外,您需要从 Cognito 解析身份令牌,而不是我认为的访问令牌。