sahat / satellizer

Token-based AngularJS Authentication
https://satellizer-sahat.rhcloud.com
MIT License
7.85k stars 1.13k forks source link

$localStorage.jwt differs from response token #714

Closed shiruken1 closed 8 years ago

shiruken1 commented 8 years ago

Hello folks!

I've been scouring the internet for help, but can't seem to get anywhere as to why the token in localStorage would be different from the one I get back from the api.

Here's the code:

$auth.login(user).then(function(response) {
$log.info(angular.toJson(response.data.token));
$log.info($localStorage.jwt);
}).catch(function(response) {
// Handle errors here, such as displaying a notification
// for invalid email and/or password.
ToastService.error(response.data.errors);
});

and here's the output:

response.data.token:
"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjEzLCJpc3MiOiJodHRwOlwvXC9sb2NhbGhvc3Q6ODAwMFwvYXV0aFwvbG9naW4iLCJpYXQiOjE0NTMxN
<here starts the difference>
zQzNTIsImV4cCI6MTQ1MzE3Nzk1MiwibmJmIjoxNDUzMTc0MzUyLCJqdGkiOiJhZDc5YzAyYmVjNGI5NWFiODY5Y2NjMmRiMTE0ODQ3NSJ9.7Ru8hubpM8EFyVGw9BchWzHYgg6VYN0sujNiseBJiac"

$localStorage.jwt:
"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjEzLCJpc3MiOiJodHRwOlwvXC9sb2NhbGhvc3Q6ODAwMFwvYXV0aFwvbG9naW4iLCJpYXQiOjE0NTMxN
<here starts the difference>
jM5NzAsImV4cCI6MTQ1MzE2NzU3MCwibmJmIjoxNDUzMTYzOTcwLCJqdGkiOiJmMTgzNGE1YzM2ZmRlNzVmMGM0YzBlYmQzZjMyOTI1ZiJ9.f-AT8PTGC2j9qg_ctQkCYYP5EHJGrxgwQbaPpkhAslQ"

Any help would be greatly appreciated.

Cheers!

shiruken1 commented 8 years ago

Whoops! My fault. It's an issue with Dingo's API.