Forum Discussion

donaldp's avatar
donaldp
Collaborator | Level 9
3 years ago

Getting invalid request for PKCEOAuthFlow.ProcessCodeFlowAsync

Hi,

 

   I'm implementing PKCE now, but getting an invalid request exception. I can't see anything that I'm doing wrong from the doco (it says everything is optional except code and appkey). This is code that was working when I was using DropboxOAuth2Helper.ProcessCodeFlowAsync (but I want to convert to not sending the secret - using a C# dotnet desktop app).

 

My initial code (using a code authorised in the browser, and the same appkey) is as follows...

```

if (code is object) {
    PKCEOAuthFlow pKCEFlow=new PKCEOAuthFlow();
// OAuth2Response dxResponse=await DropboxOAuth2Helper.ProcessCodeFlowAsync(code,APIKEY,APISECRET); note THIS CODE WAS WORKING
    OAuth2Response dxResponse=await pKCEFlow.ProcessCodeFlowAsync(code,APIKEY);

```

Then I hit the exception...

********************************** UNHANDLED EXCEPTION! Details: Dropbox.Api.OAuth2Exception: invalid_request
at Dropbox.Api.DropboxOAuth2Helper.ProcessCodeFlowAsync(String code, String appKey, String appSecret, String redirectUri, HttpClient client, String codeVerifier)

 

   Do I need to use a different authoriseURI if I'm using PKCE or something? I'm using the same one I was using with DropboxOAuth2Helper.ProcessCodeFlowAsync. Otherwise I don't know what it's not happy about. 😕

 

thanks,

  Donald.

16 Replies

Replies have been turned off for this discussion

About Dropbox API Support & Feedback

Node avatar for 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!