401 Unauthorized : Authorization →WWW-Authenticate: Signature realm="World-Check One API",algorit...

...hm="hmac-sha256",headers="(request-target) host date content-type content-length
Using C# code we are trying to connect world check API in order to get all groups "var client1 = new RestClient("https://rms-world-check-one-api-pilot.thomsonreuters.com/api-gateway-service-rest/api/v1/groups");"
var hmac = generateAuthHeader(dataToSign);
var auth = "Signature keyId=\"a4364e62-e58b-4b64-9c71-faead5417557\",algorithm=\"hmac-sha256\",headers=\"(request-target) host date\",signature=\"" + hmac + "\"";
var client1 = new RestClient("https://rms-world-check-one-api-pilot.thomsonreuters.com/api-gateway-service-rest/api/v1/groups");
var request = new RestRequest(Method.GET);
request.AddHeader("cache-control", "no-cache");
request.AddHeader("Connection", "keep-alive");
request.AddHeader("accept-encoding", "gzip, deflate");
request.AddHeader("Host", "rms-world-check-one-api-pilot.thomsonreuters.com");
//request.AddHeader("Postman-Token", "fe63f34e-6ef4-4553-957c-169c20b48d81,ad89d15f-1910-4550-ba4c-d9216fd5655f");
request.AddHeader("Cache-Control", "no-cache");
request.AddHeader("Accept", "*/*");
//request.AddHeader("User-Agent", "PostmanRuntime/7.15.0");
request.AddHeader("Authorization", auth);
//request.AddHeader("Authorization", "Signature keyId=\"a4364e62-e58b-4b64-9c71-faead5417557\",algorithm=\"hmac-sha256\",headers=\"(request-target) host date\",signature=\" + fpcXQ8jdAg1mWaGUSph0tE/ftjasjg2phaD3T5NKO4=\"");
request.AddHeader("Date", todayUTC);
IRestResponse response1 = client1.Execute(request);
Getting error in response : "StatusCode: Unauthorized, Content-Type: , Content-Length: -1)"
To genete Auth Header we are using below function:
public string generateAuthHeader(string dataToSign)
{
var signature = string.Empty;
using (var hmac = new HMACSHA256(Encoding.UTF8.GetBytes(apiSecret)))
{
var hash = hmac.ComputeHash(Encoding.UTF8.GetBytes(dataToSign));
signature = Convert.ToBase64String(hash);
}
return signature;
}
Please validate if above HMAC generation code is correct or not
Also please let me know if you need any further details
Best Answer
-
I see that you are copy and pasting the C# code that you obtained from Postman to send your API request. This will not work.
You cannot use the POSTMAN code to send HTTP requests as POSTMAN code just shows the format in which the HTTP request should be sent. So actually you have to write the actual code to generate that and not use the Postman code to connect.
We have sample C# code available in the "download" section of the developer community. Please find the link below:
https://developers.refinitiv.com/customer-and-third-party-screening/world-check-one-api/downloads
Kindly note the sample code we provide is just for testing purpose and to speed up your dev work. We expect our clients to use their code in production.
I request you to follow the belows steps for a basic GET request (to fetch the groups):
1. Find out how to generate Base 64 HMAC signature using C#. You can follow the sample code link to find this out.
2. Find out how to generate the date in the following format-Tue, 04 Jun 2019 06:24:04 GMT.
3. Use a variable to store the dataToSign value (Refer the pre request script in Postman- the code may be in JS but you can know how to write it in C#)
4. Now use api_secret and the dataToSign variable to create a base 64 HMAC signature (Refer the security document of the API documentation to know the acceptable Base 64 HMAC signature).
5. Send the request to URL -""https://rms-world-check-one-api-pilot.thomsonreuters.com/v1/groups" along with the date header value (generated in step 2) and authorization headers.
The format of the authorization header changes for each request. But a format for a get request (to fetch the group Id) is given below:
Signature keyId="{{api_key}}",algorithm="hmac-sha256",headers="(request-target) host date",signature="BASE 64 HMAC Signature".0
Answers
-
I have tried same using Postman Get operation but same issue i am facing in Postman as well.
Also under download section i am not able to get any c# sample please have a look into attached screenshot
If possible please provide sample code here as well
0 -
You are unable to access the documentation page as your email address has not been whitelisted in the back end. The reason for this is you are using a company email address but a gmail address.
Kindly register with the company email address.
Can you please tell me the pilot account name whose API key and secret you are using to request API calls.
0 -
@srivastava.nishant Following up to see if there is an update on this
0
Categories
- All Categories
- 3 Polls
- 6 AHS
- 36 Alpha
- 166 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 687 Datastream
- 1.4K DSS
- 622 Eikon COM
- 5.2K Eikon Data APIs
- 10 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- 3 Trading API
- 2.9K Elektron
- 1.4K EMA
- 254 ETA
- 557 WebSocket API
- 38 FX Venues
- 14 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 23 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 276 Open PermID
- 44 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 22 RDMS
- 1.9K Refinitiv Data Platform
- 671 Refinitiv Data Platform Libraries
- 4 LSEG Due Diligence
- LSEG Due Diligence Portal API
- 4 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.2K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 12 World-Check Customer Risk Screener
- 1K World-Check One
- 46 World-Check One Zero Footprint
- 45 Side by Side Integration API
- 2 Test Space
- 3 Thomson One Smart
- 10 TR Knowledge Graph
- 151 Transactions
- 143 REDI API
- 1.8K TREP APIs
- 4 CAT
- 27 DACS Station
- 121 Open DACS
- 1.1K RFA
- 104 UPA
- 193 TREP Infrastructure
- 229 TRKD
- 918 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 90 Workspace SDK
- 11 Element Framework
- 5 Grid
- 18 World-Check Data File
- 1 Yield Book Analytics
- 48 中文论坛