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 -
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
- 36 Alpha
- 166 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 33 Data Model Discovery
- 682 Datastream
- 1.4K DSS
- 613 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
- 248 ETA
- 552 WebSocket API
- 37 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
- 275 Open PermID
- 44 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 22 RDMS
- 1.8K Refinitiv Data Platform
- 625 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
- 26 DACS Station
- 121 Open DACS
- 1.1K RFA
- 104 UPA
- 191 TREP Infrastructure
- 228 TRKD
- 915 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 83 Workspace SDK
- 11 Element Framework
- 5 Grid
- 18 World-Check Data File
- 1 Yield Book Analytics
- 46 中文论坛