2022-12-22 17:12:15 +01:00
|
|
|
import * as plugins from './webjwt.plugins.js';
|
|
|
|
|
|
|
|
export const getDataFromJwtString = <T = any>(jwtString: string): T => {
|
|
|
|
const splitted = jwtString.split('.');
|
|
|
|
const dataBase64 = splitted[1];
|
2022-12-31 20:49:34 +01:00
|
|
|
const plainJsonString = plugins.smartstring.base64.decode(dataBase64);
|
2022-12-22 17:21:43 +01:00
|
|
|
return JSON.parse(plainJsonString);
|
2022-12-22 17:23:23 +01:00
|
|
|
};
|