Home > Enterprise >  Central login/authentication app for two separate ASP.NET MVC apps using ASP.NET Identity
Central login/authentication app for two separate ASP.NET MVC apps using ASP.NET Identity

Time:07-25

We have two separate ASP.NET MVC 5 apps, App A and App B, that have their own respective database which uses ASP.NET Identity for authentication.

We would like to have a separate app that acts as a central login for both apps. In other words, users would navigate to login.xyz.com to login with their username and password. Once they submit their login information, the app would check both databases for App A and App B to see which one they belong to. (Users will only ever be active in one db at a time). Depending on the db that they are found active in, we would then redirect them to the respective app app-a.xyz.com or app-b.xyz.com.

I'm not very familiar with ASP.NET Identity and honestly don't have much of a clue where to start. Any guidance or tips in the right direction would be much appreciated. I'm not looking for a full solution, just a good starting point. If I need to provide further information or clarification, please let me know.

CodePudding user response:

What I did was make a third database instance called "Authentication" Then you can change the "Default" connectionstring to that database, and set it up as the "Default for both apps. No middleware required.

CodePudding user response:

You can use JWT authentication. Two project must have one token generator service. With one private key, will generate valid JWT data for both apps. In your authentication service you must to extract data from token and accept/decline request actions.

  • Related