New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't read payloads instantly #22
Comments
Do you know how to access the payloads ? |
@AlessandroMinoccheri Thank you ❤️ /*
Example JWT
...
payload : {
"name": "Ningaro",
"iat": 1516239022
}
...
*/
const token = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiTmluZ2FybyIsImlhdCI6MTUxNjIzOTAyMn0.13qtyXZqQi3k2MPaxEuBBPOlQUiqWPn6_3elaK3JJVo' // Component.tsx
interface TokenPayload {
name: string
iat: number
}
const nameFromJWT = useJwt<TokenPayload>(token).decodedToken?.name! |
Try this my friend |
Thanks a lot, @hijizaly |
const { decodedToken, isExpired } = useJwt(jwt)
const exp = decodedToken.exp
this gives me an error like:
Unhandled Runtime Error
TypeError: Cannot read properties of null (reading 'exp')
The text was updated successfully, but these errors were encountered: