Attempt to request Authentication Token fails with 401
This function is taken from the examples slightly modified:
def getAuthenticationToken(self, userName, password):
authReqUrl = self.baseUrl + "Authentication/RequestToken"
credentialsData = {'Credentials': {'Username': userName, 'Password': password}}
r = requests.post(url=authReqUrl, json=credentialsData, headers=self.requestHeaders)
if (r.status_code == 200):
jsonResponse = json.loads(r.text.encode('ascii', 'ignore'))
token = {'timestamp': datetime.datetime.now(), 'token': jsonResponse["value"]}
with open('TRTH_token.pkl', 'wb') as handle:
pickle.dump(token, handle, protocol=pickle.HIGHEST_PROTOCOL)
return token
else:
print("ERROR: could not retrieve authentication token, check username and password:")
print("Status code: ", r.status_code, "\nResponse:\n", r.text)
sys.exit()
This returns the following response:
Status code: 401
Response:
{"error":{"message":"Invalid username or password"}}
The username and passwords sent as args are the ones corresponding to this website. I tried using both email and username, but neither work. Eventually, this is what I'm looking for; a simple mapping which requires authentication, therefore this question.
Thanks!
Best Answer
-
Hello @hello_world,
Please note that credentials used for this community are set at self-registration and anyone can register and be a member of this community, and obtain these creds.
TRTH and DSS credentials are assigned to customers, as part of their subscription to the product. Please contact you Refinitiv Account manager, if your organization has the product and you need help with credentials.
If you are looking to purchase or sign up for a trial, directly contact local Refinitiv sales team at https://www.refinitiv.com/en/contact-us for more information
0
Answers
-
Hi @hello_world
I modified your code a little bit to make it executable.
And I can successfully get the token.
Code:
import requests
import json
import datetime
def getAuthenticationToken(userName, password):
authReqUrl = "https://hosted.datascopeapi.reuters.com/RestApi/v1/Authentication/RequestToken"
credentialsData = {'Credentials': {'Username': userName, 'Password': password}}
headers = {
'Prefer': 'respond-async',
'Content-Type': 'application/json'
}
r = requests.post(url=authReqUrl, json=credentialsData, headers=headers)
if (r.status_code == 200):
jsonResponse = json.loads(r.text.encode('ascii', 'ignore'))
token = {'timestamp': datetime.datetime.now(), 'token': jsonResponse["value"]}
#with open('TRTH_token.pkl', 'wb') as handle:
# pickle.dump(token, handle, protocol=pickle.HIGHEST_PROTOCOL)
return token
else:
print("ERROR: could not retrieve authentication token, check username and password:")
print("Status code: ", r.status_code, "\nResponse:\n", r.text)
sys.exit()user = 'xxxxyyyy'
password = 'xxxxyyyy'
getAuthenticationToken(userName=user, password=password)0 -
Thanks for your reply @chavalit.jintamalit but it still doesn't work. I believe the credentials are simply incorrect because the username (email/user) and password with which I login into this community are the same sent as json, and the response (401) is always the same. This question talks about something similar, and the answer indicates towards a DSS username and password. Where can I get these? I mean, there is lack of documentation regarding to what username and password are required for any API. To my knowledge up to this extent there are developer community credentials, DDS credentials, Platform credentials, and whatsoever.
0 -
My fault for not being thorough enough. Both this article and this metadataKonstantin Pavlov had the same problem, as he describes in the comments of the article. Furthermore, the ThomsonReuters.Dss.Api.Authentication namespace specifies:
<Annotation Term="Org.OData.Core.V1.LongDescription" String="Talk to your DataScope representative about getting DataScope credentials. The API accepts the same credentials used for FTP and Web GUI."/>
Perhaps I could rephrase my question this way, who can I contact for DSS username and password? and how can I contact the representative? Any guidance on this is highly appreciated. Cheers!
0
Categories
- All Categories
- 6 AHS
- 37 Alpha
- 161 App Studio
- 4 Block Chain
- 4 Bot Platform
- 16 Connected Risk APIs
- 47 Data Fusion
- 30 Data Model Discovery
- 608 Datastream
- 1.3K DSS
- 577 Eikon COM
- 4.9K Eikon Data APIs
- 7 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- Trading API
- 2.7K Elektron
- 1.3K EMA
- 236 ETA
- 519 WebSocket API
- 33 FX Venues
- 10 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 20 Messenger Bot
- 2 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 59 Open Calais
- 264 Open PermID
- 39 Entity Search
- 2 Org ID
- PAM
- PAM - Logging
- 8.4K Private Comments
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 20 RDMS
- 1.4K Refinitiv Data Platform
- 367 Refinitiv Data Platform Libraries
- 3 Refinitiv Due Diligence
- LSEG Due Diligence Portal API
- 3 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.1K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 10 World-Check Customer Risk Screener
- 990 World-Check One
- 44 World-Check One Zero Footprint
- 45 Side by Side Integration API
- Test Space
- 3 Thomson One Smart
- 1.2K TR Internal
- Global Hackathon 2015
- 2 Specialists Who Code
- 10 TR Knowledge Graph
- 150 Transactions
- 142 REDI API
- 1.7K TREP APIs
- 4 CAT
- 21 DACS Station
- 117 Open DACS
- 1.1K RFA
- 103 UPA
- 172 TREP Infrastructure
- 224 TRKD
- 886 TRTH
- 5 Velocity Analytics
- 5 Wealth Management Web Services
- 59 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛