TMSDropbox.Connect Fails

According to the documentation TMSDropbox.Connect is boolean. It is supposed to:

  1. LoadTokens
  2. Refresh
  3. DoAuth
  4. SaveTokens
I have setup the correct AppKey and AppSecret, the Dropbox Authorisation occurs correctly, the application is allowed yet TMSDropbox ALWAYS returns FALSE. My test code here is very simple.

        if TMSDropbox.Connect then
          Opened := True;
          Opened := False;

So even though I go through the Dropbox Authentication successfully TMSDropbox.Connect returns FALSE? Any ideas what I'm doing wrong?


Have you tried using the OnConnected event to call SaveTokens instead?
If the problem persists, please have a look at the CloudStorageDemo application for a full working example.

Hi Bart,

Again, App is a DLL.

  Have you tried using the OnConnected event to call SaveTokens instead?

No, since the documentation states that TMSDropbox.Connect is boolean, I simply assumed that it would return True if successful. It returns False no matter what the outcome. I can see how waiting for events to be triggered gets me around the external browser issue when the code continues on after the browser instance has been created. There is one major issue However:

So my question is what happens if authentication fails?  I am waiting for an event that never gets triggered? How do I solve that particular dilemma?

OK, I have setup the OnConnected procedure, noting my earlier comment that TMSDropbox.Connected is boolean and I would expect it to return TRUE if it succeeded?

I go through the enter email and password, click allow. All functions correctly and as expected.

The OnConnected event NEVER gets triggered. Here's my logfile:

[05/10/2017 12:55:33  TRACE]  Enter Method DLLMain
[05/10/2017 12:55:33  TRACE]  Exit Method DLLMain
[05/10/2017 12:55:33  TRACE]  Enter Method getDropboxPath
[05/10/2017 12:55:33  TRACE]  Enter Method ParseJSONStr
[05/10/2017 12:55:33  TRACE]  Exit Method ParseJSONStr
[05/10/2017 12:55:33  TRACE]  Enter Method AssignMemory
[05/10/2017 12:55:33  INFO ]  TextResult: C:\Users\Kevin\Dropbox  Length: 22
[05/10/2017 12:55:33  INFO ]  BuffSize: 46
[05/10/2017 12:55:33  INFO ]  pTextResult: C:\Users\Kevin\Dropbox
[05/10/2017 12:55:33  TRACE]  Exit Method AssignMemory
[05/10/2017 12:55:33  TRACE]  Exit Method getDropboxPath
[05/10/2017 12:55:33  TRACE]  Enter Method dbx_signinDropbox
[05/10/2017 12:55:33  INFO ]  Initialization Commenced
[05/10/2017 12:55:33  INFO ]  Attempting Dropbox Signin
[05/10/2017 12:55:33  INFO ]  Trying to connect to Dropbox   IT SHOULD TRIGGER THE ONCONNECTED AFTER HERE AND IT DOESN'T
The following log events are because I do not check for authorisation and eventually the code just bombs out, BUT the ONCONNECTED event is never triggered
[05/10/2017 12:55:55  INFO ]  Authorising second Dropbox component
[05/10/2017 12:55:55  INFO ]  Second Dropbox component authorised
[05/10/2017 12:55:55  TRACE]  Exit Method dbx_signinDropbox
[05/10/2017 12:55:55  TRACE]  Enter Method dbx_refreshFolderList
[05/10/2017 12:55:55  INFO ]  pMetadata := AssignMemory(dbx_getFolderMetadata(True,eCode));
[05/10/2017 12:55:55  TRACE]  Enter Method dbx_getFolderMetadata
[05/10/2017 12:55:55  ERROR]  No folder metadata returned
[05/10/2017 12:55:55  TRACE]  Exit Method dbx_getFolderMetadata
As noted in my other post, the ONRECEIVEDACCESSTOKEN event never gets triggered, but, rather than chasing two similar issues, ie. Dropbox appears to be authorised, but NONE of the associated events get triggered, I will concerntrate in the first instance on the ONCONNECTED problem. 

I know the ONCONNECTED event works because if I execute/trigger the OnConnected event in code with:


I actually get the ShowMessage dialog with "CONNECTED" in it.

This is how I'm setting up the ONCONNECTED Event (again which never gets triggered, ie. there is no logfile entries and the showmessage function never gets executed):

  TEventHandlers = class
    procedure OnConnected(Sender : TObject);
    procedure OnReceivedAccessToken(Sender : TObject);
     EventHandlers : TEventHandlers;

.... IN the Dropbox Signin function
      // Use the TMS TAdvropbox to do the signin
      EventHandlers := TEventHandlers.Create();
      TMSDropbox := TAdvDropbox.Create(nil);
      TMSDropbox.OnConnected := EventHandlers.OnConnected;
TMSDropbox.SaveTokens;  //An ACCESS TOKEN is saved in the INI File see below so I ASSUME TMSDropbox.Connect WAS SUCCESSFUL???
procedure TEventHandlers.OnConnected(Sender: TObject);
    WriteLog('TRACE', 'Enter Method OnConnected');
    Showmessage('CONNECTED');   // This gets executed in my test so I know it is the correct event that SHOULD be, but IS NOT, triggered
    WriteLog('TRACE', 'Exit Method OnConnected');

So back to my original question, If, after a TMSDropbox.Connect, the Dropbox Authorisation webpage accepts my Email Address/Password and I click ALLOW how can I verify/validate what is/should be happening next. Clearly the OnConnected event should be triggered, but it is not. I am at a loss as to how I can debug this noting that the SaveTokens directly following the Connect ACTUALLY saves a token.

Is it possible that the TMS code is NOT getting the appropriate information to signify that Dropbox Authorisation has succeeded. This seems unlikely since the persistence (INI File) is receiving an access token??? 

The contents of the inifile (DBXSECURE.INI)


Look I am stuck and cannot proceed if I cannot authorise Dropbox. Any help really appreciated.

And just to confirm that Dropbox is successfully Authorised and the OnConnected event is NOT being triggered:

  1. Switch to External Browser
  2. Put a showmessage Directly after TMSDropbox.Connect
  3. Enter the Email/Password and press ALLOW in external browser
  4. Windows says ...Dropbox has been authorised, you can close the window...
  5. Press OK in the displayed showmessage
  6. Never get to the OnConnected event
So Dropbox is DEFINATELY being Authorised correctly
OnConnect SHOULD be triggered
OnConnect is DEFINATELY NOT being triggered

Have you tried using the CloudStorageDemo?

Is the same issue visible with the CloudStorageDemo?

If the problem persists, please enable logging and provide a log so I can further investigate this.
Logging can be enabled by setting Logging to True and LogLevel to llDetail. The log file is generated automatically in the machine's Documents folder.

Hi Bart,

Have you tried using the CloudStorageDemo?
Is the same issue visible with the CloudStorageDemo?

Just did that and it worked, here's the log - however see below this logfile though, the Dropbox DEMO Failed in exactly the same way as my application and it looks like it is trying to authorise with OAUTH1 after it gets the token. I have installed and re-installed the VCL Cloud Pack and auto/manually built it:

20171006T120213:HTTPS POST RES:200
20171006T120213:HTTPS POST:
20171006T120214:HTTPS POST RES:200
20171006T120214:GOT ACCESS TOKENS: dLi0f59i4z4AAAAAAAApdjDl5yQ7ux80i8Zt2k1QOOR6AbkXqddT4nQVaUiyjbmv / 
20171006T120542:HTTPS POST:
20171006T120542:HTTPS POST RES:200
20171006T120542:HTTPS POST RESULT:{"account_id": "dbid:AAD4_bi4MP1qQDCvIciNh3x-9sa3bciOtRA", "name": {"given_name": "Kevin", "surname": "Black", "familiar_name": "Kevin", "display_name": "Kevin Black", "abbreviated_name": "KB"}, "email": "", "email_verified": true, "profile_photo_url": "", "disabled": false, "country": "AU", "locale": "en", "referral_link": "", "is_paired": false, "account_type": {".tag": "pro"}}
20171006T120542:HTTPS POST:
20171006T120543:HTTPS POST RES:200
20171006T120543:HTTPS POST RESULT:{"entries": [{".tag": "folder", "name": "Public", "path_lower": "/public", "path_display": "/Public", "id": "id:uMctvDFrpJwAAAAAAAAJFg"}, {".tag": "folder", "name": "WA Police", "path_lower": "/wa police", "path_display": "/WA Police", "id": "id:uMctvDFrpJwAAAAAAAAJFQ", "shared_folder_id": "161128874", "sharing_info": {"read_only": false, "shared_folder_id": "161128874"}}, {".tag": "folder", "name": "Kevin Black", "path_lower": "/kevin black", "path_display": "/Kevin Black", "id": "id:uMctvDFrpJwAAAAAAAAJEw", "shared_folder_id": "95136969", "sharing_info": {"read_only": false, "shared_folder_id": "95136969"}}, {".tag": "folder", "name": "Orex Conf Admin", "path_lower": "/orex conf admin", "path_display": "/Orex Conf Admin", "id": "id:uMctvDFrpJwAAAAAAAAJEg", "shared_folder_id": "6986824", "sharing_info": {"read_only": false, "shared_folder_id": "6986824"}}, {".tag": "folder", "name": "Orex Team Share", "path_lower": "/orex team share", "path_display": "/Orex Team Share", "id": "id:uMctvDFrpJwAAAAAAAAJEA", "shared_folder_id": "2510656", "sharing_info": {"read_only": false, "shared_folder_id": "2510656"}}, {".tag": "folder", "name": "Orex External Share", "path_lower": "/orex external share", "path_display": "/Orex External Share", "id": "id:uMctvDFrpJwAAAAAAAAJDw", "shared_folder_id": "158922628", "sharing_info": {"read_only": false, "shared_folder_id": "158922628"}}, {".tag": "folder", "name": "Empyrean DLL", "path_lower": "/empyrean dll", "path_display": "/Empyrean DLL", "id": "id:uMctvDFrpJwAAAAAAAAI8A", "shared_folder_id": "271897729", "sharing_info": {"read_only": false, "shared_folder_id": "271897729"}}, {".tag": "folder", "name": "Empyrean MAC", "path_lower": "/empyrean mac", "path_display": "/Empyrean MAC", "id": "id:uMctvDFrpJwAAAAAAAAI7Q", "shared_folder_id": "553663340", "sharing_info": {"read_only": false, "shared_folder_id": "553663340"}}, {".tag": "folder", "name": "Empyrean", "path_lower": "/empyrean", "path_display": "/Empyrean", "id": "id:uMctvDFrpJwAAAAAAAAI7A", "shared_folder_id": "461867665", "sharing_info": {"read_only": false, "shared_folder_id": "461867665"}}, {".tag": "folder", "name": "non-IT", "path_lower": "/non-it", "path_display": "/non-IT", "id": "id:uMctvDFrpJwAAAAAAAAI6Q"}, {".tag": "folder", "name": "PIAB (Old) Projects", "path_lower": "/piab (old) projects", "path_display": "/PIAB (Old) Projects", "id": "id:uMctvDFrpJwAAAAAAAAytA", "shared_folder_id": "153476913", "sharing_info": {"read_only": false, "shared_folder_id": "153476913"}}, {".tag": "folder", "name": "Empyrean Exchange", "path_lower": "/empyrean exchange", "path_display": "/Empyrean Exchange", "id": "id:uMctvDFrpJwAAAAAAAAAog", "shared_folder_id": "467521025", "sharing_info": {"read_only": false, "shared_folder_id": "467521025"}}, {".tag": "folder", "name": "Empyrean Backups (GE Experts)", "path_lower": "/empyrean backups (ge experts)", "path_display": "/Empyrean Backups (GE Experts)", "id": "id:uMctvDFrpJwAAAAAAAAzwg"}, {".tag": "folder", "name": "Orex on Windows8", "path_lower": "/orex on windows8", "path_display": "/Orex on Windows8", "id": "id:uMctvDFrpJwAAAAAAAAz9A", "shared_folder_id": "809993137", "sharing_info": {"read_only": false, "shared_folder_id": "809993137"}}, {".tag": "folder", "name": "PIAB Projects", "path_lower": "/piab projects", "path_display": "/PIAB Projects", "id": "id:uMctvDFrpJwAAAAAAAA0PQ"}, {".tag": "folder", "name": "Apps", "path_lower": "/apps", "path_display": "/Apps", "id": "id:uMctvDFrpJwAAAAAAABxdg"}, {".tag": "folder", "name": "RADStudioRepos", "path_lower": "/radstudiorepos", "path_display": "/RADStudioRepos", "id": "id:uMctvDFrpJwAAAAAAAC3ZQ"}, {".tag": "folder", "name": "Aviation", "path_lower": "/aviation", "path_display": "/Aviation", "id": "id:uMctvDFrpJwAAAAAAAC4Hg"}, {".tag": "folder", "name": "PSR Files", "path_lower": "/psr files", "path_display": "/PSR Files", "id": "id:uMctvDFrpJwAAAAAAANCwA"}, {".tag": "folder", "name": "IDonDemand", "path_lower": "/idondemand", "path_display": "/IDonDemand", "id": "id:uMctvDFrpJwAAAAAAANDsw"}, {".tag": "folder", "name": "Kevin-Black Backup", "path_lower": "/kevin-black backup", "path_display": "/Kevin-Black Backup", "id": "id:uMctvDFrpJwAAAAAAANEGA"}, {".tag": "folder", "name": "Cloudfogger", "path_lower": "/cloudfogger", "path_display": "/Cloudfogger", "id": "id:uMctvDFrpJwAAAAAAANEzw", "shared_folder_id": "1054888989", "sharing_info": {"read_only": false, "shared_folder_id": "1054888989"}}, {".tag": "folder", "name": "Project XE7 Delphi DbX DLL", "path_lower": "/project xe7 delphi dbx dll", "path_display": "/Project XE7 Delphi DbX DLL", "id": "id:KAcXFipH4eAAAAAAAAAAAQ"}, {".tag": "folder", "name": "Book-Manuals", "path_lower": "/book-manuals", "path_display": "/Book-Manuals", "id": "id:7ylAq_27DsAAAAAAAAAAAQ"}, {".tag": "folder", "name": "DbXSecure Server", "path_lower": "/dbxsecure server", "path_display": "/DbXSecure Server", "id": "id:YW0XU_Mi10AAAAAAAAAAAQ"}, {".tag": "folder", "name": "DbXSecure Temp Archive", "path_lower": "/dbxsecure temp archive", "path_display": "/DbXSecure Temp Archive", "id": "id:37xrAYX4PvAAAAAAAAAAAQ"}, {".tag": "folder", "name": "DbXSecure Temp", "path_lower": "/dbxsecure temp", "path_display": "/DbXSecure Temp", "id": "id:aWRyTEW-F-AAAAAAAAAAAQ", "shared_folder_id": "852368198", "sharing_info": {"read_only": false, "shared_folder_id": "852368198"}}, {".tag": "folder", "name": "Rad Studio 10", "path_lower": "/rad studio 10", "path_display": "/Rad Studio 10", "id": "id:vynGVq84_oAAAAAAAAAAAQ", "shared_folder_id": "1212976430", "sharing_info": {"read_only": false, "shared_folder_id": "1212976430"}}, {".tag": "folder", "name": "RAD Studio Projects", "path_lower": "/rad studio projects", "path_display": "/RAD Studio Projects", "id": "id:nhFdpbcxUiAAAAAAAAAAAQ", "shared_folder_id": "1212977924", "sharing_info": {"read_only": false, "shared_folder_id": "1212977924"}}, {".tag": "folder", "name": "DbXSecureFolders", "path_lower": "/dbxsecurefolders", "path_display": "/DbXSecureFolders", "id": "id:qwP7-MY3ZeAAAAAAAAAAAQ"}, {".tag": "folder", "name": "DbXSecure USA", "path_lower": "/dbxsecure usa", "path_display": "/DbXSecure USA", "id": "id:wno4oxmHlvAAAAAAAAAAAQ", "shared_folder_id": "1234649607", "sharing_info": {"read_only": false, "shared_folder_id": "1234649607"}}, {".tag": "folder", "name": "Chris Photos", "path_lower": "/chris photos", "path_display": "/Chris Photos", "id": "id:uMctvDFrpJwAAAAAAANFIQ"}, {".tag": "folder", "name": "System Volume Information", "path_lower": "/system volume information", "path_display": "/System Volume Information", "id": "id:uMctvDFrpJwAAAAAAANGCw"}, {".tag": "folder", "name": "Camera Uploads", "path_lower": "/camera uploads", "path_display": "/Camera Uploads", "id": "id:uMctvDFrpJwAAAAAAANp-g"}, {".tag": "folder", "name": "System Common", "path_lower": "/system common", "path_display": "/System Common", "id": "id:uMctvDFrpJwAAAAAAANvgg"}, {".tag": "folder", "name": "System Windows 10 Development", "path_lower": "/system windows 10 development", "path_display": "/System Windows 10 Development", "id": "id:uMctvDFrpJwAAAAAAANvgQ"}, {".tag": "folder", "name": "System macOS Guest Main", "path_lower": "/system macos guest main", "path_display": "/System macOS Guest Main", "id": "id:uMctvDFrpJwAAAAAAANvoQ"}, {".tag": "folder", "name": "System Parallels macOS Guest Main", "path_lower": "/system parallels macos guest main", "path_display": "/System Parallels macOS Guest Main", "id": "id:uMctvDFrpJwAAAAAAANvpQ"}, {".tag": "folder", "name": "Parallels Windows 10 Guest", "path_lower": "/parallels windows 10 guest", "path_display": "/Parallels Windows 10 Guest", "id": "id:uMctvDFrpJwAAAAAAAN4mA"}, {".tag": "folder", "name": "Hash Test", "path_lower": "/hash test", "path_display": "/Hash Test", "id": "id:uMctvDFrpJwAAAAAAAN4yA"}, {".tag": "folder", "name": "DbXSecure", "path_lower": "/dbxsecure", "path_display": "/DbXSecure", "id": "id:uMctvDFrpJwAAAAAAAN9gw", "shared_folder_id": "1540538708", "sharing_info": {"read_only": false, "shared_folder_id": "1540538708"}}, {".tag": "folder", "name": "DbXSecure Testing", "path_lower": "/dbxsecure testing", "path_display": "/DbXSecure Testing", "id": "id:uMctvDFrpJwAAAAAAAN9mg", "shared_folder_id": "1549809894", "sharing_info": {"read_only": false, "shared_folder_id": "1549809894"}}, {".tag": "file", "name": ".empfsN", "path_lower": "/.empfsn", "path_display": "/.empfsN", "id": "id:uMctvDFrpJwAAAAAAAN9kQ", "client_modified": "2017-09-04T00:03:56Z", "server_modified": "2017-09-04T00:03:56Z", "rev": "4c8b66de0026775a", "size": 2372, "content_hash": "42f67c2389c77c63b819dac7a35cbf424bb0900ebb02a0179a75b5eb3aa99fe8"}], "cursor": "AAH54hSmxkB16UU0zVbVIvBe7gtnPLgfW9CdWhYJox5LSVY7bVWhtViIpBpzIAwuZfaCNaBLKD0zy1nPCgtsvlVb9X1ciZpGIKRVJnHzrabtvEsGoOot4nGzUDJD-aROF7yhwunBCouUHtXKSsZg08vWwKRvsk8XUqxKtrvXihf33JcdqQtSK3cHgnjkbLd3M6Q9E9lnYxlagwuafQo03pw4te-0tEn76Ts6eqiyK6rVU3yArGT6rvFY7RgLC28dhrSPV8S5GKYKuUdM5IAsP4iwfT_UN9VuN4Gcb7wop20OPAI1-p6dHLHYJwPukIMFDpK4FmiupNwzpSNRwEJ7Ng7kEVdf1vnoy5SBsMgGwMlbR1z7cz0xTaKh4A1Ysas9_uDVhDU467kUz-9v0V5I0D_jcpRXdJ6A-OKN-mO8NZm8UF37ll-1e7zYKBYQkQHoprUEKTEdYF5AnFUNLNDP8PPpkehznuqoGi54I5YMON5d96SpYrUr_IfzojDZfVFUbv46AuuCWaGDFy_RFFjnestPBZTZao6mJPx0-SJlyLB_BRWiJ1HXFnBdA_FfalDsBDPTF6VD3E2qa4f-5kFp8ZkVdro4F-E1hCl0C2pznlN0Dgteg1umX7Wfzx6tTTTzwDsGRnuASw7QxToGsvsJZbG-5wE9IJw5o-4xU2xD5iAhOEcFxYOofVue4w6otk2XItKR9X9G096NRVdMAA973UxcvLMQPMxIyZ1QVHSLOUjbwtz-gdzXS78fGpHw76RZcScyU_v2cJvMCTEi-g3cx2wzdEU8oU0idJp3N7VYHoq4tYems3ELl4-DqRFJPyzDZYJIzqoy1FsJMaNFq8k5f5oinSm7wAO6aBHhVtBilqGf0fwsLbsAy7_Y5tfCymZVu8YUmPWFxCjpnRvbW96hEy6qps1ur-c2zAXJAQSV4-4YO-sIm8R6poy8gbBtN2uQTFrxrdmi95Goyuk3rYk8XHutMXYjPD7bqos4NsHWYGOgSXxt2tnUJtawNJDuOKE4VdIFAIJjaiGJ3eUYqhi-zj04DZsjhYX2Te0Vi_KPPcrO5w", "has_more": false}

BUT BUT BUT, I ran the Dropbox demo and it failed in exacly the same way as my application. The logfile indicates that it is getting a token, but using OAUTH1 (I think), how can this be?

The contents of the TadvDropboxDataStore logfile are:

20171006T111624:GOT ACCESS TOKENS: dLi0f59i4z4AAAAAAAApcQKgGcwQHAbw55vq_KQjQfOhlhdGeJ68NM6zsofuNp4_ / 
20171006T111624:HTTPS GET:    <<<<---WHERE IS THIS COMING FROM
20171006T111624:HTTPS GET RESULT:{"error": "v1_retired"}
20171006T114343:HTTPS GET:
20171006T114344:HTTPS GET RESULT:{"error": "v1_retired"}

This looks to me like the token is OK, but it is still trying to use OAUTH1. So it does exactly as in my application, The webpage is displayed, I enter credentials, I allow, the connection 'looks' like it is successful, but NOTHING is displayed.  I have uninstalled and re-installed the latest version of the VCL cloud pack and I have manually compiled it checking (for example) the version numbers for CloudBase.pas (1131) and CloudCustomDropbox.pas (2002).

How can one demo use OAUTH1 and yet the other demo use OAUTH2? I am totally confused??


Hi Bart,

Well some progress (my application) although I have no idea why. I have reinstalled and rebuilt the VCL Cloud Pack yet again. I am now getting the ONConnected method executing ONLY IF I Execute TMSDropbox.Connect Twice (two times) which also generates a second ALLOW webpage.

So with:


 The logfile is:

20171006T152812:AUTH URL:

However if I execute the line twice, the ONCONNECTED Method is triggered, but I get a second ALLOW webpage after the ONCONNECTED code executes. Logfile is below (Even more confused), at no time does TMSDropbox.Connect return true:

My code is below:


 And the Logfile:

20171006T153420:HTTPS POST RES:400
20171006T153420:HTTPS POST RESULT:{"error_description": ""code": must not be empty", "error": "invalid_request"}
20171006T153424:GOT ACCESS TOKENS:  / 
1) Do you use the latest version of the components?
2) Do you use ExternalBrowser = true?
3) If so, do you see the browser appear and navigate to the Dropbox authorize page when you press Connect once?
4) When you use ExternalBrowser = true, are you sure there is no other service using port 8888, i.e. your app can effectively bind & listen on port 8888?

Hi Bruno,

1) Do you use the latest version of the components?


2) Do you use ExternalBrowser = true?

Yes (I've used both)

3) If so, do you see the browser appear and navigate to the Dropbox authorize page when you press Connect once?


4) When you use ExternalBrowser = true, are you sure there is no other service using port 8888, i.e. your app can effectively bind & listen on port 8888?

Yes, just in case I've set it up to port 8808 and this works perfectly well with the CloudStorageDemo.

From the logfile when I execute the CloudStorageDemo there is a post of the REST command with the OAUTH2 strings. It returns 200 success. This is the logfile from that demo and it works:

20171007T110553:AUTH URL:
20171007T110620:HTTPS POST RES:200

When I call TMSDropbox.Connect from my DLL, there is NO HTTPS POST after the initial setup line and therefore no return code. If TMSDropbox.Connect is called (with EXACTLY the same property settings) from my DLL it FAILS and does not try to post the credentials and the code falls straight through the command to the next line. Here is the logfile when executed from my DLL (note I get similar problems with LoadTokens, DoAuth etc - these all worked fine from my DLL in the OAUTH1 version of the component).

Because the connect is not happening the TMSDropbox.Onconnected event never gets triggered. I know it does work from my DLL because I have simply executed TMSDropbox.OnConnected line and it steps through the code perfectly. The logfile after my DLL does a TMSDropbox.Connect (nothing else):

20171007T112750:AUTH URL:

However, if, from my DLL, I execute TMSDropbox.Connect TWICE (yes TWICE) I get this in the logfile and it all sees to work correctly, ie. the TMSDropbox.Connected event gets triggered, the cloud component does all of it's things AFAIK stepping through the code (DoConnected, etc etc) although the logfile suggests it didn't succeed (ie. 400 is a bad request) - it executes the OnConnected event so it appears to connect:

20171007T113108:HTTPS POST RES:400
20171007T113108:HTTPS POST RESULT:{"error_description": ""code": must not be empty", "error": "invalid_request"}
20171007T113141:GOT ACCESS TOKENS:  / 

The question is, then:

Why does TMSDropbox.Connect (in particular and the other component methods in general) work as expected when executed from a FORM and NOT WORK when executed from a DLL. What is needed and provided by the form that is, at the moment, not provided by the DLL.

Is there some property that is set in the form and NOT set in the DLL when I dynamically create the Dropbox component?

Again, this is a 100% blocker and I am stuck, any and all help appreciated.

If necessary, I can cutout most of the stuff in my DLL and send you the source so that you can see exactly what's happening.


So now I changed YOUR CloudstorageDemo:

  1. Removed the AdvDropbox1 component
  2. Instantiated the the component dynamically as in my DLL
  3. Set the properties EXACTLY as in my DLL
  4. Set the OnConnected function, EXACTLY as in my DLL
  • subclassed the OnConnected event
  • class procedure TEventHandlers.OnConnected(Sender: TObject);
  • Gets called EXACTLY as it should
  • Used an External Browser
  • Everything worked perfectly
  • Logfile below
  • 20171007T121709:HTTPS POST RES:200
    20171007T121717:HTTPS POST:
    20171007T121718:HTTPS POST RES:200
    20171007T121718:GOT ACCESS TOKENS: dLi0f59i4z4AAAAAAAAprYopW9ibSqazU6-pAA-tMO9-fyh8LO0JGCFhNHqdopRB / 

    So the ONLY difference with the code is that yours is called from a form application and mine is called from a DLL and it does not work. And the question remains: why?

    Again, I'm happy to send you a stripped down version of my DLL that exhibits the defective behaviour?

    I can only suspect that the HTTP server that is setup to catch the callback URL doesn't work or doesn't receive the callback when it is used from a DLL. We will need to investigate this.  

    Hi Bruno,

    I can only suspect that the HTTP server that is setup to catch the callback URL doesn't work or doesn't receive the callback when it is used from a DLL. We will need to investigate this. 

    Yes, that would be good. As I noted, I can send you a cut down version of my DLL that has the sign in code that fails. It's fairly simple.

    From my perspective this is a blocker, do you have an ideas on when you might have a fix timewise. My app stopped working when OAUTH1 (API V1) was shutdown by Dropbox and I now have no options.


    Hi Bruno,

    We will need to investigate this. 

    Has anything been done to fix this. 

    As a workaround I am currently using an external application to authorise Dropbox with IPC to the DLL using named Pipes. This works most of the time, but occasionally the pipe will close prematurely (no idea why). It's a lot of stuffing around for essentially no benefit (other than the tokens get to the DLL). It involves ACK/NACK messaging, timers, retries etc for what should be a single line in the DLL. 

    So important to me.

    Sorry, it's really rare this is being used from a DLL, we haven't got any similar problem report and unfortunately workload has been so high here that we haven't been able to allocate time for this rare use-case.