Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use WebAPI 2 without OWIN authentication middleware

I would like to use ASP.NET WebAPI 2, but with my own authentication mechanism. I have tried to remove all the code that comes with SPA template in VS 2013, as well as normal WebAPI template. If I remove all auth-related code from the project and don't configure OWIN in it's Startup.Auth, I always get an error, that OWIN middleware authentication is not setup and I can't get to any controller's action.

What is the correct way to implement a token based authentication in WebAPI 2 with own code, bypassing what's aready is in OWIN host .dll's, including it's requirements of configuration?

like image 580
Maxim V. Pavlov Avatar asked Nov 17 '14 20:11

Maxim V. Pavlov


1 Answers

Similar to John answer but you can remove the OWIN when creating the WebAPI. Much cleaner approach.

To do that: Select "Change authentication" enter image description here

then choose "No Authenciation"

enter image description here

Now your project wont have the OWIN stuff

Cheers Choco

like image 102
Choco Smith Avatar answered Oct 27 '22 01:10

Choco Smith