Base solution for your next web application
Open Closed

Social login without needs of choosing a password #3652


User avatar
0
jeromevoxteneo created

Hello,

I was expecting that using aspnet zero with social login, the user didn't have the needs of choosing a password but that's not the case.

Actually when I click on Facebook icon, I'm redirected to Account/ExternalLoginCallback where I have my firstname, lastname and email prefilled and I need to provide a password.

Is there an option or something to activate to make this flow simpler:

Register with social login should logged in the user without asking to define a password.

Regards,


3 Answer(s)
  • User Avatar
    0
    alper created
    Support Team

    hi

    in facebook login there's no need to enter password. the only password you enter is your facebook password. there is a setting related to this subject "New registered users are active by default." should be activated.

  • User Avatar
    0
    jeromevoxteneo created

    Hi,

    I was already have this configuration activated.

    The problem was in ExternalLoginCallback, as the CurrentTenancyName was null and there is no tenant linked to the login Facebook, it was redirecting to the classic registration page. I change the code to handle that if there is no tenant for this login it should be link to the default one.

    switch (tenants.Count)
                        {
                            case 0:
                                //Change this line because we want that by default any member that connect with Facebook be register as default tenant
                                //return await RegisterView(loginInfo);
                                tenancyName = Donaki.MultiTenancy.Tenant.DefaultTenantName;
                                break;
                            case 1:
                                tenancyName = tenants[0].TenancyName;
                                break;
                            default:
                                return View("TenantSelection", new TenantSelectionViewModel
                                {
                                    Action = Url.Action("ExternalLoginCallback", "Account", new { returnUrl }),
                                    Tenants = tenants.MapTo<List<TenantSelectionViewModel.TenantInfo>>()
                                });
                        }
    

    After that I'm now able to register with facebook without the need to set a password.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Great :)