Need to see if your shared folder is taking up space on your dropbox 👨‍💻? Find out how to check here.

Forum Discussion

arcade's avatar
arcade
New member | Level 2
4 months ago

Getting {"error": "invalid_grant", "error_description": "invalid code verifier"}

I'm using PKCE flow https://www.dropbox.com/developers/documentation/http/documentation#oauth2-token

in my react native expo app for generating the token.

I'm able to generate code & state value successfully after hitting this url https://www.dropbox.com/oauth2/authorize 

But when i trying to get the access token using below

```

const params = new URLSearchParams({
      code,
      grant_type: "authorization_code",
      client_id: DROPBOX_CLIENT_ID,
      code_verifier: codeVerifier,
      redirect_uri: redirectUri,
    });

    console.log("PKCE params", params.toString());

    const response = await fetch("https://api.dropboxapi.com/oauth2/token", {
      method: "POST",
      headers: {
        "Content-Type": "application/x-www-form-urlencoded",
      },
      body: params.toString(),
    });

```

I'm getting this error {"error": "invalid_grant", "error_description": "invalid code verifier"}

I've verified that the code challenge and code verifier are correct and are passed correctly into the request. 

Stuck on this for hours now, need help. Thanks

1 Reply

About Discuss Dropbox Developer & API

Node avatar for Discuss Dropbox Developer & API
Make connections with other developers

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!