So, this is issue:
Uncaught InvalidCharacterError: Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.
This happens when I trying to encode data when session starts, so in auth.js I have this:
function Auth($rootScope, $window, $state, Restangular, userInfo) {
var token = $window.localStorage.token;
if (token) {
var payload = JSON.parse($window.atob(token.split('.')[1]));
$rootScope.currentUser = payload.user;
}
return {
signup: function(userinfo, callback) {
var cb = callback || angular.noop;
Restangular.all('auth/signup').post(userinfo).then(function() {
return cb();
}, function(response) {
return cb(response.data);
});
},
login: function(user, callback) {
var cb = callback || angular.noop;
Restangular.all('auth/login').post(user).then(function(data) {
$window.localStorage.token = data.token;
var payload = JSON.parse($window.atob(data.token.split('.')[1]));
$rootScope.currentUser = payload.user;
return cb();
}, function(response) {
delete $window.localStorage.token;
return cb(response.data);
});
}
On other machines it works fine, but I have this problem. So, can you tell me from what can i start to find solution? This and this already saw. There is no idea in my head