How should i be refreshing my JWT?

I just implemented netlify-identity-widget to my site and i’m trying to understand how i’m supposed to refresh my JWT when it has expired. I have found a few examples where people are doing the following to check and refresh if needed:

 const currentUser = netlifyIdentity.currentUser()
 if (currentUser) {
    currentUser.jwt().then( // Do stuff)

My issue is that i can’t see type definitions for currentUser exposing a jwt() function. Also calling it on the user object just results in jwt is not a function in runtime.

What am i missing?

ok found it under netlifyIdentity.refresh()

Was just missing type definition

1 Like