Cognito 身份验证流程失败,并显示“已找到用户名 Facebook_10155611263153532 的条目" [英] Cognito auth flow fails with "Already found an entry for username Facebook_10155611263153532"

查看:13
本文介绍了Cognito 身份验证流程失败,并显示“已找到用户名 Facebook_10155611263153532 的条目"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目标是实现一个社交提供商身份验证流程,如用户池应用集成和联合.

The goal is to implement a social provider auth flow as described in User Pools App Integration and Federation.

我想要满足的一件重要事情是合并具有相同电子邮件地址的用户池帐户.

One important thing that I want to satisfy, is to merge user pool accounts that have the same email address.

我是通过调用 adminLinkProviderForUser 在 PreSignUp_ExternalProvider 认知 lambda 触发器中.

I am accomplishing that by calling adminLinkProviderForUser within the PreSignUp_ExternalProvider cognito lambda trigger.

这样,一切正常.新的社交提供的用户正在注册并与现有的 Cognito(用户 + 通行证)用户关联.

So with this, everything works. The new social provided user is being registered and linked with the already existing Cognito (user+pass) user.

但是,从用户的角度来看,身份验证流程并未完成.在调用回调 uri(在 cognito 用户池中定义)的最后一步失败:

However, the authentication flow, from user's perspective doesn't complete. It fails at the last step where the callback uri (defined in cognito user pool) is being called:

错误:invalid_request

error: invalid_request

error_description:已找到用户名 Facebook_10155611263152353 的条目

error_description: Already found an entry for username Facebook_10155611263152353

但是,如果用户重试社交身份验证流程,一切正常,并且会获得代表原始 Cognito 用户池用户(已经拥有该电子邮件的用户)的会话令牌.

But then, if the user retries the social auth flow, everything works, and would get session tokens that represent the original Cognito User Pool user (the one that already had that email).

请注意,我正在一个空的用户池、零用户帐户上测试身份验证流程.

Note that I'm testing the auth flow on an empty User Pool, zero user accounts.

推荐答案

致所有在 2020 年仍以同样方式与此问题作斗争的可怜人:

For all the poor souls fighting with this issue still in 2020 the same way I did:

  • 我最终通过在我的客户端应用程序中捕获已找到用户名条目"并再次重复整个身份验证流程来解决该问题.
  • 幸运的是,该错误仅在初始外部提供商注册时触发,而不会在同一用户的后续登录中触发(因为它发生在注册触发期间,呃).我在胡乱猜测,但这是我认为正在发生的事情:
    • 就我而言,Facebook 提供商成功地与预先存在的 cognito 电子邮件/密码用户.新的 Facebook 用户池已成功创建链接到电子邮件/密码用户的条目.
    • 不过,似乎像 cognito 尝试注册完全隔离的 Facebook_id 用户在内部注册过程中(即使在上一步中已经创建了具有相同用户名的链接用户条目).由于链接用户"与用户名 Facebook_id 已经存在,cognito 抛出了一个已找到用户名 Facebook_id 错误的条目"内部错误.
    • 自 2017 年以来,这个错误一直在向 AWS 开发人员反映,甚至有一些他们正在解决这个问题,但到 2020 年,仍然没有解决.

    这篇关于Cognito 身份验证流程失败,并显示“已找到用户名 Facebook_10155611263153532 的条目"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆