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\":\"https://auth0.com/docs/clients/client-grant-types\"}",
  "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 ?

Thanks,

Benjamin

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