Click here to Skip to main content
15,887,434 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Friends,

I have created sample web api Token Based Authentication. In this i Want to authenticate using OWIN middleware and bearer tokens. However I already have a database and don't want to use Microsoft's new Identity framework as the majority of tables and columns that it auto generates I simply don't need. Can anyone point me in the right direction of how to apply this type of authentication without having to use the Microsoft Identity framework?.

So please can any one suggest me how can i use my own DataBase tables to achive this.

Thanks in advance,
Mohan G
Posted
Updated 13-Jan-15 2:35am
v5
Comments
ZurdoDev 12-Jan-15 9:35am    
I'm a little confused. If you want to use different tables then you need to change the code and/or config and point to your database instead. Where exactly are you stuck?
Mohan Gopi 12-Jan-15 9:41am    
Hi Ryan, Thanks for ur reply... i followed this linkhttp://bitoftech.net/2014/06/01/token-based-authentication-asp-net-web-api-2-owin-asp-net-identity/ .. in this they are using some default owin idnetification tables(default migration). i don't want to use that tables. Instead of that i need to use my table.. ex: AspNetUsers instead of this i need to use my user table. so how can i achive this. please can u suggest me....
ZurdoDev 13-Jan-15 8:34am    
1. Reply to the comment so that we are notified.
2. To use your tables you have to find the code that is calling the database and change it.

1 solution

Maybe can be useful to somebody, I found the answer here:
You will get the Solution if you refer the the follwing links...

[^]http://bitoftech.net/2014/06/01/token-based-authentication-asp-net-web-api-2-owin-asp-net-identity[^]

[^]https://github.com/tjoudeh/AngularJSAuthentication/blob/master/AngularJSAuthentication.API/Providers/SimpleAuthorizationServerProvider.cs#l-87-96[^]

In this above link (highlighted line)
<pre lang="c#">IdentityUser user = await _repo.FindUser(context.UserName, context.Password);
instead of this line you need to use your DataBase Logic..

http://www.saifikram.com/2014/06/token-based-authentication-using-asp-net-web-api-2-with-owin[^]
 
Share this answer
 
v4
Comments
Sreekanth Mothukuru 5-Aug-15 5:07am    
Customizing to our DB is quite simple until it is done :)
Member 11933502 8-Oct-18 14:52pm    
very useful!! you helped me alot!!!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900