Here is my problem. I try to make the same response as the reference above.
// get streams Example Request #1 in the reference
curl -X GET 'https://api.twitch.tv/helix/streams' \
-H 'Authorization: Bearer 2gbdx6oar67tqtcmt49t3wpcgycthx' \
-H 'Client-Id: wbmytr93xzw8zbg0p1izqyzzc5mbiz'
// my code write in JS
const request = require('request')
const process = require('process')
request(
oprions = {
url: `https://api.twitch.tv/helix/streams`,
headers: {
'Client-ID': 'ka1mgyrfu09rtyw1znuocyf6x0xciq',
'Accept': 'application/vnd.twitchtv.v5+json',
'Authorization': 'Bearer 2gbdx6oar67tqtcmt49t3wpcgycthx'
}
},
(error, response, body) => {
const json = JSON.parse(body)
console.log(body)
console.log(json)
}
)
but I always get
{"error":"Unauthorized","status":401,"message":"Invalid OAuth token"}
{ error: 'Unauthorized', status: 401, message: 'Invalid OAuth token' }
so how can I get the right authorization? and what’s the mistake I made?
THANKS LOT