0

I Currently have a MVC Project that will be for users and employee. I have a separate Android Application for my employee, How do I encorporate Asp.net Identity MVC with a Asp.net Web Api to handle my Android Authentication.

Should I redo my MVC project for a API Based Authentication for both of the Platforms? If i am going to use Web Api for Android how will I handle the Bearer Token?

Note I am only a student and this is my project so I am not that Knowledgeable but I am willing to learn. Thanks!

Hien Nguyen
  • 24,551
  • 7
  • 52
  • 62
  • 1
    I think this link is useful for you: https://stackoverflow.com/questions/31774550/mvc-5-identity-2-0-android-rest-json-api – hassan.ef Apr 27 '19 at 06:02
  • Note that I dont have a Web Api yet and my Users and Employees are purely MVC. If i Create a Seperate Identity Web Api can I use my Existing MVC Tables and Authenticate in Android? – Sentinel927 Apr 27 '19 at 06:45
  • you can use authentication with both mvc controller and api controller and dont changing about models but you can use for example asp.net identity authentication with cookie for mvc and token for mobile. – hassan.ef Apr 27 '19 at 07:04
  • I see do you have any references that I can learn this from? I have been searching for a while but have not found any. Thanks! – Sentinel927 Apr 27 '19 at 07:16
  • 1
    use this link I think its useful: https://stackoverflow.com/questions/22126305/asp-net-identity-and-mobile-clients – hassan.ef Apr 27 '19 at 07:36
  • Regarding the answer you said about having both a MVC and Api Controller, Does that mean I can create another Asp.net Identity Web Api and set the connection string to the same db as my original MVC application and be able to create,login with the same sets of users? – Sentinel927 Apr 27 '19 at 08:01
  • its not much different between mvc and api controller and when mvc upgraded to .net core both of them are the same in .netcore, then you can use asp.net identity in both of them. – hassan.ef Apr 27 '19 at 08:13
  • Sorry for the late reply, I will try this out later. Thanks! – Sentinel927 Apr 27 '19 at 12:19
  • Hello again, I am currently trying to use the Same Database for my MVC Identity and Web Api Identity. But currently cannot register with my Web Api and getting an error. – Sentinel927 May 02 '19 at 15:27
  • whats the error? – hassan.ef May 02 '19 at 15:43
  • The Photo of the Error https://imgur.com/IfXOvVp , Note I made a seperate Identity Web Api project. Should it be in the same project but just added the controlle r?Sorry if my question sounds stupid – Sentinel927 May 02 '19 at 15:59
  • I think it better create another question and put it your code in question that can be helpful for you and others. – hassan.ef May 02 '19 at 16:03

0 Answers0