简体   繁体   English

使用nodejs护照多个OAuth2.0方法登录到同一个帐户

[英]Using nodejs passport for multiple OAuth2.0 methods to login to the same account

Im trying to use passport to use OAuth2 to login but I'm not fully understanding the documentation.我试图使用护照使用 OAuth2 登录,但我不完全理解文档。

My end goal is to have the front page of my website to have multiple login options via twitch/google/facebook that all lead you to the same account if you email happens to match.我的最终目标是让我的网站首页通过 twitch/google/facebook 拥有多个登录选项,如果您的 email 恰好匹配,所有这些选项都会引导您访问同一个帐户。 (example service that does this:streamlabs login ) I want to do this without using a username and password so each of my DB docs only have a unique ID to identify each account and subsequent objects keys as twitch/google/facebook containing API tokens and emails. (执行此操作的示例服务:streamlabs login )我想在不使用用户名和密码的情况下执行此操作,因此我的每个 DB 文档只有一个唯一 ID 来标识每个帐户和后续对象键为 twitch/google/facebook,其中包含 API 令牌和电子邮件。

The part I dont understand is how to tell passport to identify the same DB doc when the user is logged in, from what I think it could be is the callback for the passport strategy registration where you use done(null, profile ) to tell passport they have been successfully authed.我不明白的部分是当用户登录时如何告诉护照识别相同的数据库文档,我认为这可能是护照策略注册的回调,您使用 done(null, profile ) 告诉护照他们已成功验证。

Would I have to change profile to the unique DB doc ID to make it universal accross all auth methods?我是否必须将配置文件更改为唯一的数据库文档 ID 以使其在所有身份验证方法中通用?

Turns out I was right, was hoping for an answer earlier before I had to change a bunch of my code事实证明我是对的,在我不得不更改一堆代码之前希望能早点得到答案

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

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