Snekfetch (Node.js) Twitch API calls - Getting if a Streamer is live (Reply))

This is a reply to @Dist on Snekfetch (Node.js) Twitch API calls - Getting if a Streamer is live

It gives me an error: UnhandledPromiseRejectionWarning: Error: 401 Unauthorized

401 suggests that you have not included an oAuth token.

If you read the actual error message, not just the HTTP header, it’ll provider further information.

All of helix requires an oAuth token of some description. And for streams, you probably want to be using an App Access Token

I’ve tried to go to this page
https://id.twitch.tv/oauth2/token?client_id=my client id&client_secret=my client secret&grant_type=client_credentials
and it says 404 page not found

It’s a POST request not a GET request.

And you are GET-ing instead of POSTing

but how can i get if a streamer is streaming or not?

First you get an App Access Token.

Then you call the streams API with that token

Or you can use Webhooks and Twitch will tell you when they go live

https://dev.twitch.tv/docs/api/webhooks-guide

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