Modify user props from React SPA


I’m sorry if this question has been asked before, I could not find the answer.

I have a React SPA in which I have users login using Universal Login. I’m currently using the Auth0Provider from the @auth0/auth0-react node package. Fetching userdata works fine.

Now I want the users to be able to modify their data (name, nickname, email). At first I created an separate API with a management key to modify the user data, but every time the data was saved the used got logged out (the data was modified though).

So I changed from using a backend to saving the data from the React frontend directly in Auth0. For this I used the auth0-js package and the Management object. I instantiated the object with domain, userToken (from the Auth0Provider), clientID and scope “read:current_user update:current_user_metadata” (I also set this scope in the React Auth0provider).
To change the (root) properties name/nickname I used the patchUserAttributes-method of the Management-object.
Unfortunately I get a 403 saying the scope is incorrect, but if I parse the token in a JWT decoder I do get the correct scope : "scope":"openid profile email read:current_user update:current_user_metadata offline_access"

I did stumble upon some answers in the forum saying that I have to get an key from the management API, but I’m uncertain on how to get that using the Auth0Provider. Or can I fetch that key from the auth0-js package using the token I got from Auth0Provider?

I was able to use the patchUserMetadata-method from the Management-api with success, but that’s not the data I want to modify.

Can anyone point me in the right direction!

Thanks a lot in advance!

Kind regards