Login with username/password is failed on React Native Expo app although it has been successfully by cURL

Hi Auth0 team,

Thanks for creating a great platform to make authentication easily. In previously, we use Lock for our React Native Expo application successfully. Now we would like to use our custom authentication UI and we found we can do it with Password Realm Grant.

I can manage to make it works by following below steps:

  1. Update Default Directory to Username-Password-Authentication (that is our database connection) in Tenant setting.
  2. Add a Native application.
  3. Go to Settings of application ⇒ Click Show Advanced Settings ⇒ Click on Grant Types Tab ⇒ Enabled Password and Refresh Token and Save.
  4. I can use cURL or Postman to get the access token
curl --request POST \
  --url 'https://{DOMAIN}/oauth/token' \
  --header 'content-type: application/x-www-form-urlencoded' \
  --data grant_type=http://auth0.com/oauth/grant-type/password-realm \
  --data username=sample@email.com \
  --data password=sample_password \
  --data audience=https://watchr \
  --data realm='Username-Password-Authentication' \
  --data scope='openid profile email' \
  --data client_id=CLIENT_ID \
  --data client_secret=CLIENT_SECRET

But when I’m trying to make the request from React Native Expo application by using fetch or axios, it’s always returns the error as below:

  "error": "access_denied",
  "error_description": "Unauthorized",

Please help to take a look and give us a direction to investigate, thanks so much!