简体   繁体   English

JS AWS Cognito 注册并链接社交提供商

[英]JS AWS Cognito Sign up and link social provider

I need to be able to have a Cognito User Pool user, with the ability to link several different social providers to that user so they can either login using a email/password (basic cognito auth) or via their social account ('email' being the common data field/username).我需要能够拥有一个 Cognito 用户池用户,能够将多个不同的社交提供商链接到该用户,以便他们可以使用电子邮件/密码(基本 Cognito 身份验证)或通过他们的社交帐户(“电子邮件”是公共数据字段/用户名)。

The flow I currently have:我目前的流程:

1) User clicks sign with Facebook, my app handles the oAuth handshake and eventually get the accessToken and email address 1)用户点击 Facebook 签名,我的应用程序处理 oAuth 握手并最终获得 accessToken 和 email 地址

2) At this point I couldn't find a way to detect if the user was already registered in the User Pool, so I attempt a Login call with a random password and infer from the error response if the user doesn't exist at all. 2)此时我找不到检测用户是否已经在用户池中注册的方法,所以我尝试使用随机密码进行登录调用,并从错误响应中推断用户是否根本不存在.

3) If the user isn't registered, I redirect the user to registration page so they can provide a Password. 3) 如果用户未注册,我会将用户重定向到注册页面,以便他们提供密码。 Once confirmed, I call SignUp to create a regular cognito user (unverified).确认后,我调用 SignUp 创建一个普通的 cognito 用户(未验证)。

From this point I am stuck.. How do I then associate the Facebook account to this newly created cognito user?从这一点开始,我被卡住了。然后如何将 Facebook 帐户关联到这个新创建的 Cognito 用户?

Note: As I'm using custom UI flow for this so using the HoC from aws-amplify-react-native library isn't possible.注意:由于我为此使用自定义 UI 流程,因此无法使用 aws-amplify-react-native 库中的 HoC。

在尝试了Amplify文档中提到的每种可能的方法之后,似乎使用federatedSignin的社交登录不能与userpool一起使用。

Only option is to use hosted ui apart from that there is no doc to integrate social login.唯一的选择是使用托管用户界面,除了没有集成社交登录的文档。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM