Merge pull request #307 from jpkrohling/JavascriptCharset

Fixed charset issue while decoding token with atob
This commit is contained in:
Bill Burke 2014-03-27 11:40:48 -04:00
commit 911cf2ae45

View file

@ -348,7 +348,7 @@ var Keycloak = function (config) {
function setToken(token, refreshToken) {
if (token) {
kc.token = token;
kc.tokenParsed = JSON.parse(atob(token.split('.')[1]));
kc.tokenParsed = JSON.parse(decodeURIComponent(escape(window.atob( token.split('.')[1] ))));
kc.authenticated = true;
kc.subject = kc.tokenParsed.sub;
kc.realmAccess = kc.tokenParsed.realm_access;