Issue with TadvDroipbox.Connect

I have installed the latest version of the TMS VCL Cloud Pack.


I am simply doing a TAdvDropbox.Connect in code. The software gets to this function in CloudBase.Pas:

function TCloudBase.HttpsPost(const ServerName, Resource,UserName,Password: string;Headers: TCoreCloudHeaders;const  PostData : AnsiString; var Response:AnsiString; HttpCommand: THTTPCommand = hcPost): Integer;

It travers down to the send the post request statements and consistently comes up with the error:

'HTTP Send Request Error 12150 Description The Request Header was not Found'

This occurs with ANY and ALL of the TMS Dropbox Calls (DoAuth etc, same error). I note an issue with the Delphi function:


But this should have been fixed in the version of RIO I'm using. Note the same calls using the TMS FMX Cloud Pack seem to work fine.

Any help appreciated this is a rate limiter for me.

Just so there is no doubt about precisely where this error is occurring:



Do you have information about the exact contents of the header sent in the HttpSendRequest call that returns this error?

Bruno, 


This is the value of Headers passed to the function:
function TCloudBase.HttpsPost(const ServerName, Resource,UserName,Password: string;Headers: TCoreCloudHeaders;const  PostData : AnsiString; var Response:AnsiString; HttpCommand: THTTPCommand = hcPost): Integer;
 as TCoreCloudHeaders:

(('Content-Type', 'application/json'), ('Authorization', 'Bearer '#$11#$008D'ûð'#$13'zˆ§Ä0'#$00AD's'#$1A'î¼\HN*'#$1F'<Žnâó'#5'Ø'#$A'^ÆøŽq)ÏŒò"Ͷ6i¹a§vÖö'))

This is the contents of the variable header returned from the statement:

header := GenerateHeader(Headers);

'Content-Type: application/json'#$D#$A'Authorization: Bearer '#$11#$008D'ûð'#$13'zˆ§Ä0'#$00AD's'#$1A'î¼\HN*'#$1F'<Žnâó'#5'Ø'#$A'^ÆøŽq)ÏŒò"Ͷ6i¹a§vÖö'#$D#$A

Is there some other value you need (these don't look correct, but they are similar to those that are seen in FMXCloudBase and they work so I assume they are as they should be).

I assume there is some way to convert these values to something that is (English) readable, can you please advise how?

Kevin

UPDATE:


If I build your CloudStorage DEMO the DoConnect for TAdvDropbox works, ie. the error described does not occur (the apply and app secret are the same for both).

I have copied your demo unit to my Test program simply as another form.

If I then run the cloud storage demo as a second form in my test app, the DoConnect fails in the same way as my DoConnect.

So clearly there is something in my application that is corrupting or sending the wrong headers. 

Again, my question is how can I render the contents of TCoreCloudHeaders into something meaningful so that I (and you) can get a feel as tho what is being passed?

is there some sort of with TCoreCloudHeaders as..... type statement?

Oh and where do you keep the log file?


 I've searched your documentation for the name and or location of the log file. It doesn't exist, which makes it a bit useless?

I have set the logging to true, and the level to iDetail (or whatever), but I cannot find the file to see if there is any useful information in it.


And I found the log in the Documents folder, but it provides NO useful information.  Twice I tried to disconnect from my application and once from your test form. The only thing logged (in detail mode) was this:


20191111T121724:HTTPS POST: api.dropbox.com/2/users/get_current_account
20191111T121731:HTTPS POST: api.dropbox.com/2/users/get_current_account
20191111T121736:HTTPS POST: api.dropbox.com/2/users/get_current_account

SOLVED:


After several days of stuffing around and rewriting and rebuilding code, turns out it was something stupidly simple.

The INI file with the credentials (Auth token etc), was one that was there from the FMX version. Instead of the software just saying these credentials are screwed, I got this weird Headers error which caused all of the grief.

Deleting the INI File and recreating it, and in turn regenerating the credentials solved the problem.


Hi,


Thank you for notifying the issue was resolved.
We'll investigate if the behavior can be improved in the future.