Hello!
I’m just trying to learn how API works and can’t actually connect it
const fetch = require("node-fetch");
// Use fetch() to make the request to the API
const url = "https://api.twitch.tv/helix/search/channels?query=a_seagull";
const options = {
headers: {
'Client-ID': '50pypihh5uaz12rzk10y9v83vra8co',
'Authorization': 'Bearer wyxhmro***9fz1cr76p7'
}
};
fetch(url, options)
.then( res => res.json() )
.then( data => console.log(data) );
It says {error: ‘Unauthorized’, status: 401, message: ‘Client ID and OAuth token do not match’}
The Client ID and OAuth token do not match error is usually because you didn’t generate your own token, so just to check is that Client ID you’re using yours, and is the OAuth token generated from one of the authorization flows by that app?
You need to follow the authentication docs https://dev.twitch.tv/docs/authentication
The Redirect URL is where the user will be sent after going through your OAuth flow. Once you’ve obtained an OAuth token from that auth process you can the use it to make API requests.
Thanks everyone for answering! But the problem was that I was trying to do everything but not trying to find my bearer accesstoken. And found it randomly in online generator. I’m really sorry for your time
P.S. I guess I missunderstanding your answers just because English is not my main