GreatDayDan
GreatDayDan

Reputation: 169

Dropbox API for Delphi, how do I send the data back to my Windows app?

I am trying to download a file from my Dropbox. The API requires a redirect url. My app does not have access to a web host. Do I need to include a TWebBrowser? Without using a host, how do I send the auth query and the token back to my app?

I am using the Dropbox API for Delphi supplied by Clever Internet. I submit my request and my browser shows "Enter this code into MMPP to finish the process." How do I send it back to my app?

procedure TDLoader.AssignCredentials(ADropbox: TDropboxManager);
begin
  ADropbox.ClientID := 'o2o.......4';
  ADropbox.ClientSecret := 'lwb..........2c';
  ADropbox.RedirectURL := 'http://localhost:55896'; // ??????
end;
procedure TDLoader.Download(const ASourceFile: string; ADestination: TStream);
var
  dbox: TDropboxManager;
begin
   Dbox := TDropboxManager.create;
   AssignCredentials(dbox);
   dbox.Download(ASourceFile, ADestination);
end;

I expected the file to d/l but instead, I got the "Enter this code into MMPP to finish the process."

Upvotes: 1

Views: 210

Answers (1)

Max
Max

Reputation: 7110

I don't know the DropBox Api but from your description I suspect you use the Device Code FLow

In this grant_type you start the flow calling a url (POST)(see docs) with scope and clientId and receive a verification_url, user_code and device_code; you must open the verification_url on browser and insert the user_code and complete the authentication.

When completed the authentication, on Delphi you must call (POST) another url (see docs) with device_code and clientId for getting the access_token.

Upvotes: 1

Related Questions