Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
arcade
4 months agoNew member | Level 2
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
- DB-Des4 months ago
Dropbox Community Moderator
Hi arcade
When you use the official Dropbox JavaScript SDK, you do not need to implement all of the logic for this process yourself. The SDK will do most of the work for you. You can find examples of using this here. More specifically, you can find an example of implementing PKCE on the back end here: https://github.com/dropbox/dropbox-sdk-js/blob/main/examples/javascript/PKCE-backend/code_flow_example.js or the front end here: https://github.com/dropbox/dropbox-sdk-js/tree/main/examples/javascript/pkce-browser
About 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!