question

Upvotes
Accepted
36 4 5 8

Tick History Rest API: Error in curl::curl_fetch_memory(url, handle = handle) : schannel: next InitializeSecurityContext failed: SEC_E_ILLEGAL_MESSAGE (0x80090326) - This error usually occurs when a fatal SSL/TLS alert is received (e.g. handshake failed).

However since the past few days I have started getting the below error while establishing connection

url <- "https://selectapi.datascope.refinitiv.com/RestApi/v1/Authentication/RequestToken"
b <- list(Credentials=list(Username=jsonlite::unbox(uname),Password=jsonlite::unbox(pword)))
r <- httr::POST(url,add_headers(prefer = "respond-async"),content_type_json(),body = b,encode = "json")


Error:.....

Error in curl::curl_fetch_memory(url, handle = handle) :
schannel: next InitializeSecurityContext failed: SEC_E_ILLEGAL_MESSAGE (0x80090326) - This error usually occurs when a fatal SSL/TLS alert is received (e.g. handshake failed).

trth-rest-api
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvote
Accepted
36 4 5 8

Hi @Jirapongse

Client was able to resolve the issue at their end.

The issue seems to be with the underlying curl.exe file. The actual solution is present in this stackoverflow thread.

https://stackoverflow.com/questions/64147821/error-running-weathercan-package-fatal-ssl-tls-alert-e-g-handshake-failed

1666287389966blob.jpg


icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
32.2k 39 11 19

Hello @Vinod A ,

I am assuming that your credential remains valid, and you are able to login to DSS GUI portal successfully.

I would try to determine if the access issue is limited to curl request. By testing with RTH Postman Starter -> User authentication request or RTH Python Code Samples to see if the authentication request goes through this could be confirmed.

Let us know how this works on your side, and if you are able to narrow down the issue specifically to curl requests


icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
36 4 5 8

Hi @zoya faberov Thank you. I do not see any issues on my side. This has been raised by client.


Client is using R libraries to extract tick history data . And have been using the same code base for over and year and has been working up until now. Nothing has changed on their side and would want to know reason why it’s not working anymore.

However since the past few days they have started getting the below error while establishing connection

url <- "https://selectapi.datascope.refinitiv.com/RestApi/v1/Authentication/RequestToken"

b <- list(Credentials=list(Username=jsonlite::unbox(uname),Password=jsonlite::unbox(pword)))

r <- httr::POST(url,add_headers(prefer = "respond-async"),content_type_json(),body = b,encode = "json")

Error:.....

Error in curl::curl_fetch_memory(url, handle = handle) :

schannel: next InitializeSecurityContext failed: SEC_E_ILLEGAL_MESSAGE (0x80090326) - This error usually occurs when a fatal SSL/TLS alert is received (e.g. handshake failed).

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
55.9k 145 45 65

@Vinod A

Sorry about the issue that you are facing.

I can run the code properly. Internally, httr uses libcurl to send HTTP requests. According to the error message, the libcurl is unable to establish the connection to the DSS server with schannel. You may need to enable a verbose log to see more information.

r <- httr::POST(url,add_headers(prefer = "respond-async"),content_type_json(),body = b,encode = "json", config=config(verbose=1))

Then, you will see the following log on the console.

1666148328452.png

I hope that this information is of help.


1666148328452.png (39.8 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
36 4 5 8

Hi @Jirapongse - Thank you for your help.

Client is still getting the same errors.

1.jpg
Can you paste the output of sessionInfo() from your Rsession. I can try and compare what version of curl and httr packages you have.


1.jpg (41.6 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

@Vinod A

Please see below.

1666226272198.png

1666226272198.png (47.4 KiB)
Upvotes
36 4 5 8

Hi @Jirapongse, Unfortunately, this did not help client.

Is there any firewall issues that could impact this ?

Or any recent update in norton anti virus you are aware of that could prevent the ssl connection to be established?

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
55.9k 145 45 65

@Vinod A

I assumed that the client uses Windows. According to this page, curl is available on Windows 10/11.

You can run the following command in the command prompt or PowerShell to verify the curl version.

curl.exe -V

1666274282708.png

It should use Schannel.

Then, run the following command to test the connection.

curl.exe -iv -H "Content-Type: application/json" -H "Prefer: respond-async" -X POST -d "{\"Credentials\": {\"Username\": \"username\",\"Password\": \"password\"}}" https://selectapi.datascope.refinitiv.com/RestApi/v1/Authentication/RequestToken

1666274434288.png

If the problem also happens with this curl command, it could relate to settings on the machine.


1666274282708.png (16.3 KiB)
1666274434288.png (58.7 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.