Set user_metadata on postRegistration using actions

Hey everyone,

I need to generate an API key on another service when the user registers, so I am using Actions, this part works perfectly and I’m able to get the api key.

The next step is to store the key in the user_metadata. I have tried using the Management API according to this post here. But my website being a SPA. I have an error which is :

  "message": "{\"error\":\"unauthorized_client\",\"error_description\":\"Grant type 'client_credentials' not allowed for the client.\",\"error_uri\":\"\"}",
  "name": "unauthorized_client"

I have looked up the documentation (the one linked in the error and this one) but I couldn’t find a way to programmatically generate an API token.

Can anyone help me there ?



If someone has an idea to solve the problem that would be great

Hi @benjamin.soulas
Thanks for contacting us at Auth0 Community. apologies for the delay on this one.

You can update user metadata in actions via the following method:

api.user.setUserMetadata(‘foo’, 123);

I would use the Pre-User Registration action as the API object is available here.

I hope this helps.