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

标签 amazon-web-services amazon-cognito google-authentication

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

用户可以登录,但我似乎只能找回用户email , email_verified和一个 username喜欢 Google_xxxxxxxxxxxxxxx在我的身份验证回调和认知登录/注册 Lambda Hook 中。

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

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

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

最佳答案

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

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

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

关于amazon-web-services - AWS Cognito Google 身份提供商获取个人资料名字和姓氏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62175512/

相关文章:

python - Django/PostgreSQL 全文搜索 - 在 AWS RDS PostgreSQL 上使用 SearchVector 与 SearchVectorField 时的不同搜索结果

amazon-web-services - Terraform 不同步

未调用 IOS AWS Cognito 处理程序并返回错误的数据集值

amazon-ec2 - 拒绝为目标域生成登录提示的权限。 ec2 实例中的谷歌身份验证错误

mobile - 亚马逊 S3 权限

amazon-web-services - 如何为 DynamoDB 查询选择分区键?

android - 尝试使用 googleSingIn 进行 firebase 身份验证时,Flutter 无法捕获 PlatformException

.net - 如何使用由 ServiceAccountCredential 认证的 SpreadsheetsService?

java - spring-integration-aws java配置

ios - 带有 iOS 的 Amazon Cognito : Access to Identity Forbidden