services.AddAuthentication().AddGoogle(googleOptions =>
{
googleOptions.ClientId = configuration["Authentication:Google:ClientId"];
googleOptions.ClientSecret = configuration["Authentication:Google:ClientSecret"];
googleOptions.CallbackPath = "/signin-google/";
});
services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
.AddCookie(options =>
{
options.LoginPath = "/Auth/Login";
options.Cookie.Name = "AshProgHelpCookie";
});
services.AddIdentity<IdentityUser, IdentityRole>(options =>
{
// Configure password requirements
options.Password.RequiredUniqueChars = 0;
options.Password.RequireUppercase = false;
options.Password.RequireLowercase = false;
options.Password.RequiredLength = 6;
options.Password.RequireNonAlphanumeric = false;
})
.AddEntityFrameworkStores<DataContext>()
.AddDefaultTokenProviders();
/*services.AddAuthorization(options =>
{
options.FallbackPolicy = new AuthorizationPolicyBuilder()
.RequireAuthenticatedUser()
.Build();
});*/
services.AddScoped<IAuthService, AuthService>();
services.AddScoped<IProfileService, ProfileService>();
services.AddTransient<IEmailSender, EmailSender>();
services.AddControllersWithViews();
builder.Services.RegisterCoreConfiguration(builder.Configuration);
builder.Services.RegisterCoreDependencies();
upper program.cs , i used microsoft documentation but it return me this:
I think it need to add javascript code for user get info and it redirect that user is authorized or create a controller.