When a JWT is expired, you need to use VincentWebAppClient.redirectToConsentPage to get a new JWT
import { jwt } from '@lit-protocol/vincent-sdk'; const { decode, isExpired } = jwt; const decodedVincentJWT = decode(jwt); const isJWTExpired = isExpired(decodedVincentJWT); if(!isJWTExpired) { // User is logged in } else { // User needs to get a new JWT vincentWebAppClient.redirectToConsentPage({redirectUri: window.location.href }); } Copy
import { jwt } from '@lit-protocol/vincent-sdk'; const { decode, isExpired } = jwt; const decodedVincentJWT = decode(jwt); const isJWTExpired = isExpired(decodedVincentJWT); if(!isJWTExpired) { // User is logged in } else { // User needs to get a new JWT vincentWebAppClient.redirectToConsentPage({redirectUri: window.location.href }); }
Checks if a JWT is expired based on its 'exp' claim
true if expired, false otherwise
When a JWT is expired, you need to use VincentWebAppClient.redirectToConsentPage to get a new JWT
Example