User info not refreshed on getSession from nextjs sdk

I’m using auth0 universal login with nextjs-auth0 SDK to manage authentication in my app.

If a User object has its information updated whilst the user is already logged in, that information will remain stale and the getSession method from the SDK will not update it.
To fix this, I call the ‘/userinfo’ endpoint as an workaround to get the user refreshed data, but sometimes I’m getting rate-limited. ( I do this in the middleware of my app - code below )

I’ve deployed my app on CF pages, and there’s some issues while using that and fetch API cache for data management, so I have implemented caching with an timeout of 30 seconds as can be seen here:

Is there another way to work around this to refresh the user data?

2 Likes

I am also running into this issue, any ideas?

1 Like

This also happened with me, I’m now using your workaround but I get rate limited still :frowning: