facebook - Fusionauth user with two possibillity to login
问题描述
Let's assume I have several types of users in one application in fusionauth. One of them with role A
can register/login by fusionauth standard login mechanism. Another one with role 'B' can login via facebook.
The user with role B
receives the role A
. Now he has both roles.
Is it possible to somehow allow him login both ways ? Is it possible to add a registration to this user so he can set a password a login the standard way ?
解决方案
If I understand your use case correctly, this is definitely possible in FusionAuth. Here's a diagram that illustrates the relationships in FusionAuth:
User <--- UserRegistration ---> Application <--- ApplicationRole
| ^
\--------------------------------------/
Let's say your user is joe@example.com
. Joe can login through Facebook initially and FusionAuth can be configured to create a User object for him. This is called "Create Registration" and is part of Identity Provider configuration.
Later, if Joe clicks the "Forgot Password" link, FusionAuth will send him an email and he can then set a new password.
This means that at anytime, Joe can now login using Facebook or using his email address and password.
In addition, Joe can have multiple UserRegistration objects. Let's say that you have two Applications, one called A
and one called B
. When Joe logged in using Facebook the first time, if he was signing into Application A
, FusionAuth would have created a UserRegistration object for him for Application A
and this UserRegistration would be granted all of the default ApplicationRoles for Application A
.
Later, if Joe did the "Forgot Password" workflow and then logged into Application B
, FusionAuth can be configured to create a UserRegistration object for Joe in Application B
and this would have also granted Joe all of the default roles for Application B
. This configuration is under the Application on the Registration tab. If you enable registrations for an Application then FusionAuth will create UserRegistration objects for Users that exist but don't have a UserRegistration for the Application they are logging into.
Lastly, you can grant Joe any additional roles for any Application using the /api/user/registration
API (https://fusionauth.io/docs/v1/tech/apis/registrations).
推荐阅读
- python - 如何在不复制父文件路径的情况下使用 shutil.copytree?
- python - 从列表中选择 n 个值,跨越范围
- spring-boot - Spring Security AuthenticationSuccessHandler 和 MockMvc
- python - 查找并单击脚本元素内的元素
- batch-file - 拖放多个文件以使用日志解析器
- docker - 尝试在 RHEL7 上安装 docker 映像时出现错误“No such container sandbox-hdp”
- php - 在php中如何解决setlocale冲突
- javascript - Jest 测试在渲染时不会因错误而失败
- selenium-webdriver - 单击 selenium webdriver 中的提交按钮后,IE11 中显示的空白网页
- node.js - Mongoose findByIdAndUpdate 似乎绕过了我的预“保存”钩子并返回过时的数据