Home > Software design >  Google sign-in provider without ASP.NET Core Identity
Google sign-in provider without ASP.NET Core Identity

Time:02-02

Following the example from Microsoft at enter image description here

enter image description here

CodePudding user response:

Can modify the code like this?

builder.Services.AddAuthentication(options =>
{
    options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
    options.DefaultChallengeScheme = GoogleDefaults.AuthenticationScheme;
})
.AddCookie()
.AddGoogle(GoogleDefaults.AuthenticationScheme, options =>
{
    options.ClientId = builder.Configuration["Authentication:Google:ClientId"];
    options.ClientSecret = builder.Configuration["Authentication:Google:ClientSecret"];
});

CodePudding user response:

This approach also solved the issue (setting SignInScheme)

options.ClientId = configuration["Google:ClientId"];
options.ClientSecret = configuration["Google:ClientSecret"];
options.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
  •  Tags:  
  • Related