Adding Identity to an existing project

10,493

Solution 1

Well, in one respect, you simply have to add the Nuget package and start writing code with it, but I think you're probably talking about all the extras: the pre-written code and samples for doing things like password resets, two-factor auth, etc.

For that, no, there's not really an easy way, at least in the sense of click a button and go. What I would recommend is creating a new MVC 5 project with Individual Auth, and then adding the Identity Samples Nuget package to it. Then, open your existing project in another Visual Studio window and copy/paste or use the sample code as a guide for writing your own.

Solution 2

Here's a tutorial that I followed for adding ASP.Net Identity to an existing project. It's up to date and from a reputed source at the asp.net/identity site.

Solution 3

I think the easiest way to do that is to do the following steps:

  • Install All Identity Packages from nugets to your existing MVC project.

  • Create New MVC Project and choose Authentication type: Individual Authentication.

  • Copy IdentityModels.cs and all related files including (controllers, views and IdentityConfig) from New project to an existing MVC project.

  • Add migration to create required tables on database.

Solution 4

I will echo what Chris said. there is no "easy way" . here is a video link featuring Scott Allen (a pioneer in web dev (Video link)

You can check his other videos as well

Share:
10,493

Related videos on Youtube

Zach Johanson
Author by

Zach Johanson

Updated on June 04, 2022

Comments

  • Zach Johanson
    Zach Johanson almost 2 years

    I've got an MVC project, and I want to add Identity to it, but I can't seem to find any good articles on how to do so.

    Is there an easy way to add Identity to an existing project?

    I already have a database with stuff in it