I am updating users profile but wont work

I am using react SDK and using useAth0 hook to fetch user. When I am trying to update a user’s profile using management API (getAccessTokenSilently) I receive a success message but the useAuth0 hook returns me old user’s data (nickname) and if I try logging in again it gives me an updated nickname.

Hi @pandeysumit832 ,

This is likely due to the ID token that has been cached being used for the user profile object.

You could call the getAccessTokenSilently with the option ignoreCache=true to ensure Auth0 fetches the latest object after a change rather than referring to what it has cached.

1 Like

Thank you so much for reverting back to me. I also have one more question for you can we do the same with the management API patch request?

Hi @pandeysumit832 ,

You can patch a user via this endpoint:

And you can search for a user, or GET a user via their ID using the following endpoints, respecitvely:

When looking for updates on a user via the Management API, please note that some requests are more immediate than others in reflecting changes:

1 Like

I was suffering from this issue since 5 days thanks for sharing it.

1 Like

No worries, we’re here for you!

We have tried this solution but I am afraid it’s not working for us. Since we have used cacheLoaction = “localstorage” in our Auth0Provider. Can you help us with that?

Hi @pandeysumit832 , you should be able to use the ignoreCache option on the getAccessTokenSilently call itself for when you need to ensure you have the most up to date version of the user profile, this wouldn’t be set at the Auth0Provider level.

2 Likes

I m sorry i didn’t get it

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.