Base solution for your next web application
Open Closed

Social login buttons are not visible. #4952


User avatar
0
affern created

Hello. I'm trying to enable social login buttons for Google and Facebook. I have registered my app and have my authentication keys in appsettings.json and set "IsEnabled": "true". But GetExternalAuthenticationProviders() in TokenAuthController returns 0.

I can see that ConfigureExternalAuthProviders() in GlobalOpinionsWebHostModule class is adding my providers to the list when the solution starts up.

So why can _externalAuthConfiguration.Providers in this code return 0?

[HttpGet] public List<ExternalLoginProviderInfoModel> GetExternalAuthenticationProviders() { return ObjectMapper.Map<List<ExternalLoginProviderInfoModel>>(_externalAuthConfiguration.Providers); }

Is there something I've forgotten? I'm using the Angular version.

Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)

26 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @affern,

    Thank you for finding the problem. You can create a new class and add it as the second parameter for <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/blob/master/aspnet-core/src/MyCompanyName.AbpZeroTemplate.Web.Core/Controllers/TokenAuthController.cs#L342">https://github.com/aspnetzero/aspnet-ze ... er.cs#L342</a>.

    You can also create a new method in UserRegistrationManager which gets your new parameters as well. It's code will be similar to existing RegisterAsync but you will set your new parmeters on user as you like.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)