Call to grab my following-list doesn't work anymore?


I’ve got this PHP script that grabs my list of live people I’m following using the following line of code:

$result = file_get_contents(‘*******************&stream_type=live’, false);

(Reference: )

It used to work fine, but it seems to have not found anyone since the end of April, and I’m getting a 401 error (“Token invalid or missing required scope”) when I try testing it. I used to be able to just put that link in a browser and get the JSON back. Did anything change in the API to cause this to start failing? I see a pinned topic about requiring a client_id in August, but it’s not August yet.

I may’ve changed my Twitch password around the time it started failing, but I forget when I did it, and my email junk folder only goes back ten days. I’ve tried plugging in a new oauth token, and still no luck. It’s been a while since I’ve set this up, though; is my URL correct? Also, is the oauth token I use for the URL the same thing I use to connect to chat through IRC, or is it related to a Developer Application? Do tokens expire? I’ve got some code in an older application that grabs developer-stuff, but I don’t remember using it to set this up (shoulda left better code comments…).

Thanks in advance,

Check that the token is valid and has user_read scope with[token_here]

There haven’t been any API changes to make this start failing. @3ventic has the right idea. Check your OAuth token scopes. Client-ID wouldn’t matter in this case because you’re providing an OAuth token. Tokens don’t expire. Your URL looks fine to me.

I checked it, and all it’s got for scope is chat_login. I’m not positive this is the oauth I was using when it was working, though; I screwed with the code last week trying to fix it and I know I changed the oauth about a hundred times. None of the other encrypted-string-looking things seem to work either. How should I be generating the oauth for this?

@TheCowness Makes sense. You might have used one of the community tools to create a chat OAuth token, and it only requests that particular scope. To generate a new token, you can use one of the code flows as described in the documentation.

Looks like I’ve got it working now, and I took notes on how I got the token this time. Still not sure why it stopped working before; it must’ve been my password change. Guess I’ll keep that in mind. Thanks again.

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