Questions tagged [asp.net-identity]

The ASP.NET Identity system is designed to replace the previous ASP.NET Membership and Simple Membership systems.

The ASP.NET Identity system is designed to replace the previous ASP.NET Membership and Simple Membership systems. It includes profile support, OAuth integration, works with OWIN, and is included with the ASP.NET templates shipped with Visual Studio 2013.

ASP.NET Identity uses code-first Entity Framework to allow for maximum customization through class manipulation, annotation, and new fluent API.

Useful links

8860 questions
57
votes
9 answers

Merge MyDbContext with IdentityDbContext

I have a MyDbContext in a separated Data Accass Layer class library project. And I have an ASP.NET MVC 5 project with a default IdentityDbContext. The two context use the same database, and I want to use AspNetUsers table to foreign key for some my…
martonx
  • 1,972
  • 4
  • 25
  • 42
53
votes
14 answers

InvalidOperationException: Cannot create a DbSet for 'Role' because this type is not included in the model for the context

The following solution works in .net core 1.1, but after upgrading from 1.1 to 2.0, I received the following error: InvalidOperationException: Cannot create a DbSet for 'Role' because this type is not included in the model for the context. When…
001
  • 62,807
  • 94
  • 230
  • 350
53
votes
2 answers

How to use JWT in MVC application for authentication and authorization?

I planned to use ASP.NET Identity 2.0 in an ASP.NET MVC application for authentication and authorization. Referring the below link JSON Web Token in ASP.NET Web API 2 using Owin I was able to create a access token(JWT) for the valid user i.e., When…
SDK
  • 1,532
  • 1
  • 15
  • 31
53
votes
9 answers

Value cannot be null. Parameter name: value, CreateIdentityAsync?

I created a ViewModel(UserModel) that implement IUser (for customizing ASP.NET Identity 2.0) public class UserModel : IUser { public int Id { get; set; } public string SecurityStamp { get; set; } [Display(Name = "Name")] …
Mohammad Dayyan
  • 21,578
  • 41
  • 164
  • 232
52
votes
1 answer

UseOAuthBearerTokens vs UseOAuthBearerAuthentication

In our Startup class, I have configured the following auth server options: OAuthAuthorizationServerOptions OAuthServerOptions = new OAuthAuthorizationServerOptions() { AllowInsecureHttp = true, TokenEndpointPath = new…
Dave New
  • 38,496
  • 59
  • 215
  • 394
52
votes
10 answers

The entity type ApplicationUser is not part of the model for the current context

I'm migrating from Identity 1.0.0 to Identity 2.0.1 following this article and the migrations code generated is nothing about the new IdentityUser. It doesn't add the new columns. So I made a new project and tried again but the migrations codes is…
Marc
  • 16,170
  • 20
  • 76
  • 119
50
votes
6 answers

Moving ASP.NET Identity model to class library

I am trying to move the Identity model to a class library using the methods in this link: ASP.NET Identity in Services library Problem 1: It seems to keep using the Website project's connection string. I overcame it by specifying the full…
Joe Yap
  • 501
  • 1
  • 5
  • 3
50
votes
4 answers

how to implement ASP.NET Identity to an empty MVC project

I create a new empty MVC project and I want to add identity to it. Now I do not know how to do this and how to create database and tables and classes. I searched but I did not find any useful solution for my question, I found an article for adding…
Kamran Sadin
  • 921
  • 1
  • 11
  • 18
50
votes
2 answers

User in Entity type MVC5 EF6

I have created a class in MVC5, where I want a primary owner of the content and then I want to have some editors for the content: public class Content { public int ID { get; set; } public IdentityUser Owner { get; set; } public…
Gunnar
  • 986
  • 3
  • 10
  • 24
49
votes
6 answers

Mocking new Microsoft Entity Framework Identity UserManager and RoleManager

Has anyone come up with a successful mocking solution for UserManager and RoleManager? I have been beating my head against a wall all day. All I want to do is mock the objects to use an in memory collection rather than hitting the Entity Framework…
Dale Alleshouse
  • 1,627
  • 2
  • 17
  • 24
49
votes
3 answers

ASP.NET Web API 2: How do I log in with external authentication services?

According to this post http://www.asp.net/web-api/overview/security/external-authentication-services... I'm able to log in with a local authentication service (with the new ASP.NET identity framework) but I can't find a walkthrough to properly call…
acor3
  • 633
  • 1
  • 6
  • 9
49
votes
1 answer

How do you login/authenticate a user with Asp.Net MVC5 RTM bits using AspNet.Identity?

I have been working on a web application using MVC5, EF6, and VS 2013. I spent some time upgrading to the RC bits once released. Thanks to all the great posts out there: eg. Decoupling Microsoft.AspNet.Identity.* and Updating asp.net MVC from…
ACG
  • 750
  • 2
  • 6
  • 16
48
votes
10 answers

AddIdentity() fails "InvalidOperationException: Scheme already exists: Identity.Application"

I'm trying to add facebook login to my .NET Core 2.1 site I'm following this , guide and more specific, this (for facebook login) After have adding the lines below to startup.cs, inside ConfigureServices-method public void…
Cowborg
  • 2,645
  • 3
  • 34
  • 51
48
votes
1 answer

Get UserID of logged-in user in Asp.Net MVC 5

I'm relatively new to ASP.Net MVC and try to use the built-in user login functionality now. I'm able to register an user in the registration view. If I try to login with the created user this also works. I'm redirected to the master page. But I'm…
Philipp Eger
  • 2,235
  • 4
  • 23
  • 34
48
votes
6 answers

Register IAuthenticationManager with Unity

I'm using Unity for Dependencies Injection and using Identiy Provider to manage the user login, register, email confirmation, etc. When I try to register a user, I have this problem: The current type, Microsoft.Owin.Security.IAuthenticationManager,…
chemitaxis
  • 13,889
  • 17
  • 74
  • 125