Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is possible to use cookie based authentication with ASP.NET Web API and SPA?

I want to create the web application which will be based on angularjs frontend and ASP.NET Web API. I need create the secure api but I can't use the token based authentication on the company's server where will be implemented this web application.

Is possible use the cookie based authentication for SPA and ASP.NET Web API?

How can I configure the cookie based authentication on the ASP.NET project for this scenario where I have the SPA and Web API?

like image 674
Jenan Avatar asked May 13 '16 19:05

Jenan


1 Answers

The TokenBased Authentication is currently used in SPA based on BackEnd API applications is to overcome the limitation of cookiebased authentication But since you have decided to go with it then you can use OWIN cookieAuthentication middleware which will do the needful. Here's an article showing how to configure the OWIN cookie authentication middleware in Asp.net project(No matter if it's WebApi or MVC application).

like image 189
vendettamit Avatar answered Oct 07 '22 20:10

vendettamit