function decodeJwtResponse(t) {
let token = {};
token.raw = t;
token.header = JSON.parse(window.atob(t.split('.')[0]));
var base64 = t.split('.')[1].replace(/-/g, '+').replace(/_/g, '/');
var jsonPayload = decodeURIComponent(window.atob(base64).split('').map(function(c) {
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
}).join(''));
token.payload = JSON.parse(jsonPayload);
return (token)
}
More than 1 year has passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme