curl_setopt($ch, CURLOPT_RETURNTRANSFER, true)
and
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1)
are the same thing
That would suggest the token specified here is an App Access Token.
Where did you run the request? In a console on Twitch or in JS client side code on your own server? (If console on Twitch cookies may have interferred)
You can also run/test your token against the validate endpoint Authentication | Twitch Developers :
$ch = curl_init('https://id.twitch.tv/oauth2/validate');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Authorization: OAuth ' . $_SESSION['token']->access_token
));
$r = curl_exec($ch);
$i = curl_getinfo($ch);
curl_close($ch);
And check $r to check your token type to see if it returns a user ID in the response.
That’ll help determine what kind of token you have