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 '' \
-H 'Authorization: Bearer 2gbdx6oar67tqtcmt49t3wpcgycthx' \
-H 'Client-Id: wbmytr93xzw8zbg0p1izqyzzc5mbiz'
// my code write in JS
const request = require('request')
const process = require('process')

  oprions = {
    url: ``,
    headers: {
    	'Client-ID': 'ka1mgyrfu09rtyw1znuocyf6x0xciq',
    	'Accept': 'application/vnd.twitchtv.v5+json',
    	'Authorization': 'Bearer 2gbdx6oar67tqtcmt49t3wpcgycthx'

  (error, response, body) => {
    const json = JSON.parse(body)


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?

The Authentication Docs 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.