Not able to get the authentication token using curl command from Linux server

While trying to get the session token by using curl command, getting below error.

{"error":{"message":"Invalid username or password"}}

However we are able to login through GUI using same credentails. Also using SOAP UI we can request the token and get it back in response. Below is full curl command.

curl -H "Content-Type: application/json" -H "Prefer: respond-async" -X POST -d'{"Credentials": {"Username": "Your Username","Password": "Your Password"}}' https://hosted.datascopeapi.reuters.com/RestApi/v1/Authentication/RequestToken

Please help.

Best Answer

  • Jirapongse
    Answer ✓

    @Ayan

    If the resolved IP is an IP of the DR site, the authentication will be failed.

    The DataScope Disaster Recovery site should be accessed only upon notification of an actual failover from Thomson Reuters. Service alerts are provided to clients if a failover is invoked and also when the Disaster Recovery site is ready for client access. DataScope Service alerts can be subscribed at https://my.thomsonreuters.com/pages?name=notifications.

    On Subscription Wizard, please search for Datascope Select and Thomson Reuters Tick History. Then, select the subscribed products. At least, you should select DataScope Select Service.

    image

    From historical alert, on 05-Mar-17 there was "DataScope Select - Planned Maintenance and Disaster Recovery Testing".

    image

    For more information about this testing, please refer to PCN 8868 and the attached document on that PCN (Product Change Notification).

Answers

  • Ayan, the account credentials (username and password) for TRTH v1 (and SOAP API) are not the same as those for TRTH v2 (and REST API).

    If you have TRTH v2 credentials try them in the TRTH v2 GUI. If you can log in, then they are valid, in which case they should work in the API.

    Please contact your local account manager if you do not have TRTH v2 account credentials.

  • Using the same credentials I can login to TRTHV2 GUI and which is valid as you have mentioned. However I am still getting the same issue while using curl command in unix. Below is the command.

    curl -H "Content-Type: application/json" -k -H "Prefer: respond-async" -X POST -d'{"Credentials": {"Username": "my user id","Password": "my password"}}' https://10.xxx.xxx.xxx/RestApi/v1/Authentication/RequestToken

  • Also tried with below command. The below query was considered as a best answer in a question in this community.

    curl -i -X POST -k -H "Content-Type: application/json" -H "Prefer: respond-async" -d "{\"Credentials\": { \"Username\": \"****\", \"Password\": \"****\"}}" https://10.xxx.xxx.xxx/RestApi/v1/Authentication/RequestToken

    Output :

    * About to connect() to 10.xxx.xxx.xxx port 443 (#0) * Trying 10.xxx.xxx.xxx... connected * Connected to 10.xxx.xxx.xxx (10.xxx.xxx.xxx) port 443 (#0) * Initializing NSS with certpath: sql:/etc/pki/nssdb * warning: ignoring value of ssl.verifyhost * skipping SSL peer certificate verification * SSL connection using TLS_RSA_WITH_RC4_128_MD5 * Server certificate: * subject: CN=hosted.datascopeapi.reuters.com,O=Thomson Reuters,L=New York,ST=New York,C=US * start date: Nov 14 00:00:00 2015 GMT * expire date: Nov 14 23:59:59 2017 GMT * common name: hosted.datascopeapi.reuters.com * issuer: CN=Symantec Class 3 Secure Server CA - G4,OU=Symantec Trust Network,O=Symantec Corporation,C=US > POST /RestApi/v1/Authentication/RequestToken HTTP/1.1 > User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.18 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2 > Host: 10.xxx.xxx.xxx > Accept: */* > Content-Type: application/json > Prefer: respond-async > Content-Length: 66 > < HTTP/1.1 401 Unauthorized HTTP/1.1 401 Unauthorized < Set-Cookie: DSSAPI-COOKIE=R1530954311; path=/ Set-Cookie: DSSAPI-COOKIE=R1530954311; path=/ < Cache-Control: no-cache Cache-Control: no-cache < Pragma: no-cache Pragma: no-cache < Content-Type: application/json; charset=utf-8 Content-Type: application/json; charset=utf-8 < Expires: -1 Expires: -1 < Server: Microsoft-IIS/7.5 Server: Microsoft-IIS/7.5 < WWW-Authenticate: Basic WWW-Authenticate: Basic < X-Request-Execution-Correlation-Id: 2dfdcf86-8f68-4d60-9bbf-bcf19ed7a579 X-Request-Execution-Correlation-Id: 2dfdcf86-8f68-4d60-9bbf-bcf19ed7a579 < X-App-Id: Custom.RestApi X-App-Id: Custom.RestApi < X-App-Version: 11.1.534.64 X-App-Version: 11.1.534.64 < Date: Mon, 10 Jul 2017 14:49:29 GMT Date: Mon, 10 Jul 2017 14:49:29 GMT < Content-Length: 52 Content-Length: 52 < * Connection #0 to host 10.xxx.xxx.xxx left intact * Closing connection #0 {"error":{"message":"Invalid username or password"}}

  • It should relate to the settings of firewall (10.xxx.xxx.xxx). Please contact the firewall admin team to verify its settings.

  • SCB network team verified and found there is no issues at SCB end.

  • @Ayan

    Could you please verify what the IP address to which hosted.datascopeapi.reuters.com has been resolved on the Firewall?