Web forum is in read-only mode. Login as active registered customer for write access
  Forum Search   New Posts New Posts

Issue with TadvDroipbox.Connect

 Post Reply Post Reply
Author
Black Kevin View Drop Down
Member
Member
Avatar

Joined: 23 Dec 2013
Posts: 86
Post Options Post Options   Quote Black Kevin Quote  Post ReplyReply Direct Link To This Post Topic: Issue with TadvDroipbox.Connect
    Posted: 08 Nov 2019 at 5:44am
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:

function ReadHeader(ARequest: HINTERNET; AHeaderFlag: DWORD; const AHeaderName: string = ''): string;

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.

Back to Top
Black Kevin View Drop Down
Member
Member
Avatar

Joined: 23 Dec 2013
Posts: 86
Post Options Post Options   Quote Black Kevin Quote  Post ReplyReply Direct Link To This Post Posted: 08 Nov 2019 at 6:04am
Just so there is no doubt about precisely where this error is occurring:


Back to Top
Bruno Fierens View Drop Down
TMS Support
TMS Support
Avatar

Joined: 11 May 2010
Posts: 8410
Post Options Post Options   Quote Bruno Fierens Quote  Post ReplyReply Direct Link To This Post Posted: 09 Nov 2019 at 10:59am
Do you have information about the exact contents of the header sent in the HttpSendRequest call that returns this error?
Back to Top
Black Kevin View Drop Down
Member
Member
Avatar

Joined: 23 Dec 2013
Posts: 86
Post Options Post Options   Quote Black Kevin Quote  Post ReplyReply Direct Link To This Post Posted: 10 Nov 2019 at 10:08am
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'z0'#$00AD's'#$1A'\HN*'#$1F'<n'#5''#$A'^q)ό"Ͷ6iav'))

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'z0'#$00AD's'#$1A'\HN*'#$1F'<n'#5''#$A'^q)ό"Ͷ6iav'#$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
Back to Top
Black Kevin View Drop Down
Member
Member
Avatar

Joined: 23 Dec 2013
Posts: 86
Post Options Post Options   Quote Black Kevin Quote  Post ReplyReply Direct Link To This Post Posted: 11 Nov 2019 at 2:06am
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?

Back to Top
Black Kevin View Drop Down
Member
Member
Avatar

Joined: 23 Dec 2013
Posts: 86
Post Options Post Options   Quote Black Kevin Quote  Post ReplyReply Direct Link To This Post Posted: 11 Nov 2019 at 2:11am
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.


Back to Top
Black Kevin View Drop Down
Member
Member
Avatar

Joined: 23 Dec 2013
Posts: 86
Post Options Post Options   Quote Black Kevin Quote  Post ReplyReply Direct Link To This Post Posted: 11 Nov 2019 at 2:20am
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
Back to Top
Black Kevin View Drop Down
Member
Member
Avatar

Joined: 23 Dec 2013
Posts: 86
Post Options Post Options   Quote Black Kevin Quote  Post ReplyReply Direct Link To This Post Posted: 11 Nov 2019 at 3:35am
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.


Back to Top
Bart Holvoet View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 2166
Post Options Post Options   Quote Bart Holvoet Quote  Post ReplyReply Direct Link To This Post Posted: 12 Nov 2019 at 3:31pm
Hi,

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

Forum Jump Forum Permissions View Drop Down