I’m facing an issue using netlify-identity-widget where users are automatically logged out after spending more than an hour on the site. I’ve tried various fixes, notably running netlifyIdentity.currentUser()?.jwt?.(true) before API calls if the token is expired, as well as running netlifyIdentity.currentUser()?.jwt?.(true) every hour just before the scheduled expiry time. Problem with those approaches is that I have been getting random 500 responses from the endpoint called by the jwt() method, which force-logs-out the user. Not sure what causes the 500 responses but they don’t always happen.
After further testing, I can confirm that netlifyIdentity.currentUser()?.jwt?.(true) works for the first minutes on the page, but after a few minutes, would cause a 500 response. Going on another page seems to make the function work again, oddly.
It’s not possible to remember the user forever. JWTs are signed only for 60 mins. You would have to use a custom JWT secret and sign a custom token for that. About login issues: