You need to specify client_id from your app too or result will look like this:
{"error":"Bad Request","status":400,"message":"No client id specified"}
I still can’t figure out why it says that token isn’t valid. I just tried to do everything from scratch, I removed access for my app from my Twitch account, then got fresh new auth token, answer from API looked like this:
array (
'code' => 'zx6suwv4ln8ulgmzr16do4zlnlcogy',
'scope' => 'user_read chat_login',
)
But if you open this link, it still says token isn’t valid:
https://api.twitch.tv/kraken?oauth_token=zx6suwv4ln8ulgmzr16do4zlnlcogy&client_id=nghxxhkkcscw61pw1w9k6jmzqb1f3kl
And if you open this link:
https://api.twitch.tv/kraken/user?oauth_token=zx6suwv4ln8ulgmzr16do4zlnlcogy&client_id=nghxxhkkcscw61pw1w9k6jmzqb1f3kl
It returns:
{"error":"Unauthorized","status":401,"message":"Token invalid or missing required scope"}