Tick History Rest API: Error in curl::curl_fetch_memory(url, handle = handle) : schannel: next Initi

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).

Tagged:

Best Answer

Answers

  • 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


  • 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).

  • @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.

  • 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.

  • @Vinod A

    Please see below.

    1666226272198.png

  • 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?

  • @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.