How to get valid Oauth token

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

The Authentication Docs https://dev.twitch.tv/docs/authentication explain the process of how to get an OAuth token, you can’t just copy the tokens from the examples.

thanks you~ finally, i get the data

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.