AngularJS with web API authentication

I recently started learning AngularJS and I am trying to create a simple login system. Some of the methods for creating and storing cookies for authorization looked a lot more complicated than the .net approach I was using, so I first thought I should continue to use this authentication method by making an API call and keeping the angular UI free of all of this.

This option was suggested in this post here -

How to handle authentication in angular JS app

However, when I try to implement this, it authenticates fine, but does not store this cookie. If I go back to the API and try something referencing the cookie like

FormsAuthentication.GetAuthCookie(userName, createPersistentCookie);

      

He will simply say that there is nothing there.

Is there an easy way to store this cookie in the API that I am not using?

+3


source to share


1 answer


This is how you can do it, it will also allow you to include custom information in the auth cookie.



fooobar.com/questions/13508 / ...

+1


source







All Articles