fix(tkeg): JWT 파싱 시 한글 이름 깨짐 수정 (UTF-8 디코딩)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -23,7 +23,12 @@ function parseJwt(token) {
|
|||||||
try {
|
try {
|
||||||
const base64Url = token.split('.')[1];
|
const base64Url = token.split('.')[1];
|
||||||
const base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/');
|
const base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/');
|
||||||
return JSON.parse(atob(base64));
|
const jsonPayload = decodeURIComponent(
|
||||||
|
atob(base64).split('').map(c =>
|
||||||
|
'%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2)
|
||||||
|
).join('')
|
||||||
|
);
|
||||||
|
return JSON.parse(jsonPayload);
|
||||||
} catch { return null; }
|
} catch { return null; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user