mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 21:05:19 +00:00
fix: userInfo name conversion encoding format (#755)
This commit is contained in:
@@ -100,17 +100,13 @@ class Token {
|
||||
static parse(token: string): AccessTokenMessage | null {
|
||||
try {
|
||||
return JSON.parse(
|
||||
String.fromCharCode.apply(
|
||||
null,
|
||||
Array.from(
|
||||
Uint8Array.from(
|
||||
window.atob(
|
||||
// split jwt
|
||||
token.split('.')[1]
|
||||
),
|
||||
c => c.charCodeAt(0)
|
||||
)
|
||||
)
|
||||
decodeURIComponent(
|
||||
atob(token.split('.')[1])
|
||||
.split('')
|
||||
.map(function (c) {
|
||||
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
|
||||
})
|
||||
.join('')
|
||||
)
|
||||
);
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user