How to customize login screen in Asp.Net Core 2.1

0

With the following service settings below, I can log in to Twitter, Hotmail, Facebook.

Noting that my project at creation time enabled the individual login option

services.AddAuthentication()
        .AddTwitter(twitterOptions =>
        {
           twitterOptions.ConsumerKey = "#######";
           twitterOptions.ConsumerSecret = "#######";
            })
        .AddFacebook(facebookOptions => 
        {
           facebookOptions.AppId = "#######";
           facebookOptions.AppSecret = "#######";
         })
         .AddMicrosoftAccount(microsoftOptions =>
         {
            microsoftOptions.ClientId = "#######";
            microsoftOptions.ClientSecret = "#######";
         });

With service settings made:

  • I want to create a page that will be the initial
  • The home page will only have logins buttons through social networks
  • Example of the page I want to do this below.

The question is:

How do I configure the buttons with images of social networks within a custom page in Asp.Net Core 2.1 to perform the logins

Asp.Net MVC has the following configuration inside _ExternalLoginListPartial.cshtml

 @using Microsoft.Owin.Security
 @foreach (AuthenticationDescription p in loginProviders) 
 {
     <button type="submit" class="btn btn-default" id="@p.AuthenticationType" name="provider" value="@p.AuthenticationType" title="Faça login usando sua conta @p.Caption">@p.AuthenticationType</button>
 }

    
asked by anonymous 22.11.2018 / 01:39

1 answer

0

Friend, I did not quite understand your question, however you can do the following:

  • In the open project, right-click it, click Add, and then click New Scaffolded Item, as follows:
  • 2.Onthenewscreen,chooseIdentityandthentheLoginandExternalLoginviews,ready,nowcustomize.

    You actually need to use SignInManager.GetExternalAuthenticationSchemesAsync () to get the schemas and then use it on your buttons and make a submit for ExternalLogin. But look at the generated files that I believe will be easy.

        
    30.12.2018 / 03:36