This call results in a HTTP 4xx, but you don’t test the resulting HTTP Code
This URL is incomplete you didn’t specify a user_id in your query string parameters, so the API didn’t know whose follows to return
Only the Get Users API support “look up via token”
So you’d want to
- do the
codetotokenexchange - then call Get Users to get the users userID - Reference | Twitch Developers
- then call Get User Follows
https://api.twitch.tv/helix/users/follows?user_id=USERID- Reference | Twitch Developers
You should also update your PHP code to be more error tolerant.
You don’t test if your get HTTP 200 response
You don’t test if your JSON Decode succeeded
A code example that might be of use https://github.com/BarryCarlyon/twitch_misc/blob/main/authentication/user_access_generator/php/index.php#L38