How to make Netlify Identity widget remember user? (ie not log them out after a while)

Site name: or

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.

Any guidance?

Here’s the latest 500 response at /.netlify/identity/token
Internal Server Error - Request ID: 01G01V7GV5N35CGRCCHRV5QA50

I believe any logs for this request would be hidden from me. Could Netlify support possibly look into this one for me?

Many thanks

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:

Hi @Memo_Team,

Our team has updated us on the issue and this should be working now. Please let us know if you’re still having issues with the 500 response.


Working flawlessly. Thanks.