Error, calling api: Invalid OAuth token

Hey, i use nodejs and wanted to get Game, Title and Uptime from my Stream with help of the API

This is my Code, but i get the error

{ error: ‘Unauthorized’, status: 401, message: ‘Invalid OAuth token’ }

I checked my config and the token and the client ID are right…

Maybe useful info: I get the token and the ClientID from

This is the code i use:

const querystring = require("querystring"),
    fetch = require("node-fetch");
const config = require("./config.json");

const CLIENT_ID = config.client_id;
const TOKEN = config.token;
const STREAMS_URL = "";

const qs = querystring.stringify({
    first: 2

const qUrl = `${STREAMS_URL}?${qs}`;

const fetchArgs = {
    headers: {
        'Client-Id': CLIENT_ID,
        'Authorization': 'Bearer ' + TOKEN

fetch(qUrl, fetchArgs)
    .then(res => res.json())
    .then(data => console.log(data))
    .catch(err => console.error(err));

You can’t get a token from the console.

This sounds like you tried to use your Client Secret as a token.

You need to generate an oAuth token to use as documented;

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