title: How to get access token from api in react native
body: <p>I am using react native and i want to get the access token from api which is created in django using oAuth 2 authentication</p>
  
  <p>i am passing all the details which are required but i do not know why i am getting error of unsupported grant type</p>
  
  <pre><code>fetch('MyApiUrl', {
              method: 'POST',
              headers: {
                  'Accept': 'application/json',
                  'Content-Type': 'application/x-www-form-urlencoded',
              },
              body: JSON.stringify({
                  'grant_type': 'password',
                  'username': 'MyUserNameSettedInApi',
                  'password': 'PasswordSettedInApi',
                  'client_id': 'MyClientId',
                  'client_secret': 'MyClientSecret',
                  'scope': 'read Write'
              })
          })
              .then((response) =&gt; response)     &lt;----tried response.json() but giving same error of grant type
              .then((responseData) =&gt; {
                  console.log(responseData);
              })
  </code></pre>
  
  <p>My expected result is i want access token should display 
  and what i am getting is</p>
  
  <pre><code>Response {type: "default", status: 400, ok: false, statusText: undefined, headers: Headers, …}
  headers: Headers {map: {…}}
  ok: false
  status: 400
  statusText: undefined
  type: "default"
  url: "http://MyUrl"
  _bodyInit: "{"error": "unsupported_grant_type"}"
  _bodyText: "{"error": "unsupported_grant_type"}"
  __proto__: Object
  </code></pre>
  
  <p>please help
  thanks in advance</p>