Status code 401 - unauthorized / token expired
I am trying to access the /search/beta1 in the Elektron Data Platform for a small proof of concept I am building. I've generated the app key and am including it in the Authorization header in the request. However, when I go to fetch from my front-end, I am being returned an error object that looks like so:
{
code: "401",
id: "e02f9ec2-2986-49d5-ab62-9d066539c9ce",
message: "token expired",
status: "Unauthorized"
}
I am just trying to fetch the same results that is included in the api playground, so my fetching looks like this:
export async function fetchRef() {
const url = 'https://api.refinitiv.com/search/beta1/';
const key = '9e2708*********b85abce1f4';
const response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: "Bearer " + key,
},
body: JSON.stringify({
View: "People",
Query: "cto microsoft"
})
});
const json = await response.json();
console.log(json);
}
Is there something I am doing wrong? I cannot seem to find any documentation that would tell me otherwise. I inspected the request that is sent from the api playground, and I noticed the "key" is a much longer one that I was provided in the generator. Am I using the wrong key, and where would I get this new key?
Thank you in advance for your help!
Best Answer
-
Hi @justin.mckenzie, You seem to be using the Refresh Token instead of Access Token in your request. Please see the EDP tutorials and download the working code samples in Python or Postman.
PS: This is a public forum, so do not post credentials in the posts. I have removed the key from your question.
0
Answers
-
Hi @Gurpreet. thanks for your reply. Am I able to do this with a simple frontend (receive authorization tokens and then use them in subsequent requests) or will I need to use a Node or Python back end to be able to do so?
0 -
Hi Gurpreet thanks for your reply. Am I able to do this with a simple frontend (receive authorization tokens and then use them in subsequent requests) or will I need to use a Node or Python back end to be able to do so?
0 -
EDP supports Authorization Code and Implicit grant, which can be used in the browser based applications.
API Playground is implemented using Implicit grant.
0 -
Hello @justin.mckenzie
For more details about tokens, requests and responses, please see Authorization - All about tokens tutorial
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 中文论坛