Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
508 views
in Technique[技术] by (71.8m points)

Delphi REST Authentication issues with 10.4.1

I have a Delphi REST server (running as a service) and Firemonkey Android and Windows clients which interact with the server. These were essentially created using the various datasnap wizards. The server and client were initially created without authentication.

Authentication was "retro-fitted" in Delphi 10.3.3 by implementing an OnUserAuthenticate event for the DSAuthenticationManager object in the WebModuleUnit; and at the client end by setting the username and password in the DSRestConnection object in the ClientModuleUnit (generated as per wizard). This all worked fine.

However, on migrating the application to Delphi 10.4.1, the clients initially could not connect to the server. This was overcome by adding an OnAuthentication event to the DSRESTConnection object.

2 anomalies were thrown up with this setup: First when right-clicking the DSRESTConnection object in the IDE (with server running) and selecting either "Test Connection" or "Generate Datasnap client classes" both throw the error below. (I get the same error if I try to create a new server and client (with authentication) using the Datasnap wizards).

Error querying headers (12019): The handle is in the wrong state for the requested operation

Secondly, if the android client is updated via the IDE (with the onAuthentication event assigned to the DSRESTConnection), all works OK. However, if the APK is "deployed" by using MSBuild as below, it dies upon loading. If I remove the onAuthentication event, and deploy using the MSbuild script it works fine.

msbuild %proj_name% /v:q  /p:Platform=Android /t:Build;Deploy  %config%

(where config typically = "Release")

It seems reasonable to assume that these 2 issues have a common root, but I cannot find it.

question from:https://stackoverflow.com/questions/65928918/delphi-rest-authentication-issues-with-10-4-1

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...