I have two roles in my REST back-end (built with Spring):
ROLE_USER, ROLE_ADMIN
When I log in, the REST API returns a valid token. Then I set it in the local storage like this:
localStorage.setItem('currentUser', JSON.stringify({username: username, token: token}));
And when I need it I get it like this:
localStorage.getItem('currentUser');
So far so good. When I get my token how do I get the payload and the claims in it?
I want to show admin panel if you are an admin.
jwtHelper.decodeToken($scope.jwt)
See https://github.com/auth0/angular-jwt and https://github.com/auth0/angular2-jwt