Netlify-identity-widget currentUser object not refreshing after lambda update

Following this guide: GitHub - netlify/gotrue-js: JavaScript client library for GoTrue I am able to update a user through admin methods in a lambda function. However, I am not able to see those updates immediately on my site through the netlify-identity-widget’s currentUser object (GitHub - netlify/netlify-identity-widget: A zero config, framework free Netlify Identity widget) even after refreshing the page. I am forced to log the users out and back in to see the changes. Is there a way I can trigger currentUser to update/refresh manually? Thank you!

1 Like

Hi @vdadfar,

The save() operation returns the updated user object that you can use in your app. However the currentUser() is not updated by this operation, but it should update the next time you refresh the jwt using .jwt() (GitHub - netlify/gotrue-js: JavaScript client library for GoTrue). Note that if your current JWT isn’t expired then you have to pass a truthy value into the jwt() call to force it get you a new token. Or you can log out then log back in again. Let me know if this helps!

2 Likes