You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The decodeJWTPayload function should be like this:
export function decodeJWTPayload(token: string) {
// Regex checks for base64url format
const base64UrlRegex = /^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}=?$|[a-z0-9_-]{2}(==)?$)$/i
const parts = token.split('.')
if (parts.length !== 3) {
throw new Error('JWT is not valid: not a JWT structure')
}
if (!base64UrlRegex.test(parts[1] as string)) {
throw new Error('JWT is not valid: payload is not in base64url format')
}
const base64Url = parts[1] as string;
return JSON.parse(decodeBase64URL(base64Url))
}
Screenshots
System information
OS: macOS
Browser: chrome
Version of supabase-js: 2.45.2
Version of Node.js: 18.17.1
The text was updated successfully, but these errors were encountered:
Bug report
Describe the bug
I found the TypeScript error in decodeJWTPayload function in https://github.com/supabase/auth-js/blob/master/src/lib/helpers.ts
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
Expected behavior
The decodeJWTPayload function should be like this:
Screenshots
System information
The text was updated successfully, but these errors were encountered: