We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
ancso
4 years agoHelpful | Level 6
Can't get PKCE access token uses javascript fetch request
I am trying to utilize the PKCE in a background script of chrome extension example shows the following: curl https://api.dropbox.com/oauth2/token \
-d code=<AUTHORIZATION_CODE> \
-d grant_typ...
- 4 years ago
yes!
that was the problem
my apologies I missed these arguments in the request URLhowever,
i am now getting the error{error: 'invalid_grant', error_description: 'invalid code verifier'}The URL includes both code_challenge and code_challenge_method
and looks like:https://www.dropbox.com/oauth2/authorize?response_type=code&client_id=<client_id>&code_challenge=<code_challenge>&code_challenge_method=S256
and the parameters sent to oauth2/token are:client_id=<client_id>&grant_type=authorization_code&code=<auth code from dropbox>&code_verifier=<128 char verifier>i also made sure that <code challenge> is a SHA256 hash of <128 char verifier> by testing it at https://emn178.github.io/online-tools/sha256.html
what am i missing?
ancso
4 years agoHelpful | Level 6
yes,
i experience the same behavior
if using an expired code i get the same error "code doesn't exist or has expired":
HTTP/1.1 400 Bad Request
Content-Security-Policy: sandbox allow-forms allow-scripts
Content-Type: application/json
Accept-Encoding: identity,gzip
Date: Wed, 12 Jan 2022 02:27:14 GMT
Server: envoy
Content-Length: 84
X-Dropbox-Response-Origin: far_remote
X-Dropbox-Request-Id: 7ff4794a94a846b0bfcbc750fbe48fd5
{"error": "invalid_grant", "error_description": "code doesn't exist or has expired"}
however
if using a working code i get:
HTTP/1.1 400 Bad Request
Content-Security-Policy: sandbox allow-forms allow-scripts
Content-Type: application/json
Accept-Encoding: identity,gzip
Date: Wed, 12 Jan 2022 02:25:18 GMT
Server: envoy
Content-Length: 97
X-Dropbox-Response-Origin: far_remote
X-Dropbox-Request-Id: 320762d3550c4d8a8e9e46a5ddc6b091
{"error": "invalid_request", "error_description": "No auth function available for given request"}
ancso
4 years agoHelpful | Level 6
is there a way we can debug this online together?
maybe in an online meeting?
About Dropbox API Support & Feedback
Find help with the Dropbox API from 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!