ASP.NET Core Identity 2.0 SignoutAsync is not logging out user if the user signed in with Google

The problem is that your RedirectToAction overwrites the redirect to the Identity Server endsession URL that SignOutAsync issues. As for SignOutAsync, what is obsolete is the Authentication portion — as of ASP.NET Core 2.0 it’s an extension directly off HttpContext itself. (The same explanation for the same signout problem is given here by Microsoft’s HaoK.) … Read more

Unable to resolve service for type ‘Microsoft.AspNetCore.Identity.UserManager` while attempting to activate ‘AuthController’

You need to use the same user data model in SignInManager, UserManager and services.AddIdentity. Same principal is true if you are using your own custom application role model class. So, change services.AddIdentity<IdentityUser, IdentityRole>(options => { options.User.RequireUniqueEmail = false; }) .AddEntityFrameworkStores<Providers.Database.EFProvider.DataContext>() .AddDefaultTokenProviders(); to services.AddIdentity<Automobile.Models.Account, IdentityRole>(options => { options.User.RequireUniqueEmail = false; }) .AddEntityFrameworkStores<Providers.Database.EFProvider.DataContext>() .AddDefaultTokenProviders();

Asp.net core Identity successful login redirecting back to login page

In order to get the ASP.NET Core pipeline to recognise that a user is signed in, a call to UseAuthentication is required in the Configure method of your Startup class, like so: app.UseAuthentication(); app.UseMvc(); // Order here is important (explained below). Using the Cookies authentication scheme, the use of UseAuthentication loosely performs the following: Reads … Read more

.NET Core 2.1 Identity get all users with their associated roles

I have now implemented the following solution. As CodeNotFound pointed out in the comments, IdentityUser used to have a Roles property. This is no longer the case in .NET Core. This comment/issue on GitHub seems to be the current solution for .Net Core. I have attempted to implemented it with the following code: ApplicationUser public … Read more

tech