CPA
CPA

Reputation: 3053

Role based AngularJS JWT authentication

I have an angularJS web application. To serve data from the backend to the SPA I'm using asp.net web api.

At the backend I implemented JSON web token authentication like in this great blog post: http://bitoftech.net/2015/03/31/asp-net-web-api-claims-authorization-with-asp-net-identity-2-1/

Now I'm looking for an implementation at client-side. I found a lot of angular packages for authentication. But I couldn't found any using JSON web token and role based authentication.

Do you know any solution with:

The backend solution is working very well and I would like to find a suitable angularJS frontend solution.

Upvotes: 1

Views: 1992

Answers (1)

Faraji Anderson
Faraji Anderson

Reputation: 661

Wanting all of these combined is a little bit of wishful thinking. There's a pretty good Github repo for JWT + Refresh token logic https://github.com/auth0/angular-jwt the library uses interceptors to send authentication header info with each request.

Honestly homie, you'd be better off creating your own Angular services to handle these. I would suggest creating a service that kept track of user roles and then using localstorage to note if the user has been authenticated with Facebook, Twitter, etc... https://github.com/fnakstad/angular-client-side-auth

Upvotes: 4

Related Questions