Auth0 React Native retrieve Bearer Token from Auth0 Management API

  auth0, javascript, react-native

How can I retrieve an Auth0 Bearer Token from Auth0 Management API in an react native application?

I am currently using the Bearer token from the Auth0 dashboard. This is only recommended for testing. Now I want to move to production. Here the docs how to retrieve the Bearer Token in production: AUTH0 DOKU

And this is how I try it in my react native app:

     fetch(``, {
              method: "POST",
              headers: {'content-type': 'application/x-www-form-urlencoded'},
              body: JSON.stringify({
                  grant_type: 'client_credentials',
                  client_id: 'XXX',
                  client_secret: 'XXX',
                  audience: ''
          }).then(res => res.json())
              .then(async (data) => {
                  console.log('fetched a BEARER TOKEN', data);

but I get the following response:

{"error": "access_denied", "error_description": "Unauthorized"}

I am using the credentials from my dashboard (Auth0 Management API – Test tab, then it fills in the red. in the code suggestion)

When trying it with the provided CURL request it works.

Somebody knows what I am doing wrong?
Thanks for the help!

Source: Ask Javascript Questions