Search code examples
react-nativedropboxdropbox-api

Error while getting Dropbox access token of user


I am currently trying to add a Dropbox file upload system in my react-native application. I have created an app in Dropbox console with App Folder access. When the user goes to my redirect URL, then I'm fetching the access token with the help of the Authorization code received from the login.

 await fetch(
      `https://api.dropbox.com/oauth2/token?code=${code}&grant_type=authorization_code&client_id=${appKey}&redirect_uri=https://www.google.com/`,
      requestOptions,
    )
      .then(response => response.text())
      .then(result => console.log(result))
      .catch(error => console.log('error', error));
  }

Here is my code for the same. But this gives me an error

{"error_description": "No auth function available for given request", "error": "invalid_request"}

Anyone ever faced this error or any idea about the reason for the same?
Question already has an answer here but that didn't help either.


Solution

  • This error is indicating that the request didn't supply the necessary parameters for this call.

    If you are using the non-PKCE code flow, that's because you aren't supplying the client_secret parameter.

    If you are using the PKCE flow, that's because you aren't supplying the code_verifier parameter.

    You can find the documentation for the Dropbox /oauth2/token endpoint here.