web/plugins/ParseJwt/page.jsx

9 lines
215 B
React
Raw Normal View History

2023-10-19 11:44:56 +03:30
export function ParseJwt(token) {
if (!token) {
return;
}
const base64Url = token.split(".")[1];
const base64 = base64Url.replace("-", "+").replace("_", "/");
return JSON.parse(window.atob(base64));
}