Client and Auth dont match

So this has been bugging me, i did the whole:
https://id.twitch.tv/oauth2/authorize?response_type=token&client_id=urpkwc3o****ay1lu49pyzt&redirect_uri=http://pnkllr.net/token&force_verify=true

And it spat out:
http://pnkllr.net/token#access_token=dfva8mebnd****8ss2l42wpm&scope=&token_type=bearer

However it keeps telling me that Client ID and Oauth dont match? What am I missing?

What are you passing in your Authorization header?
If you’re calling a kraken (v5) endpoint, it should to be “OAuth dfva8mebnd****8ss2l42wpm”
If you’re calling a helix (“new”) endpoint, you need “Bearer dfva8mebnd****8ss2l42wpm”

If that doesn’t help, which endpoint are you calling? Is it one which requires a particular scope? (you haven’t specified any)

Im using helix endpoints

curl_setopt($ch, CURLOPT_HTTPHEADER, ['Client-ID: ' . $clientID ]);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer ' . $token]);

It doesnt require any scope, im just trying to get my recent VOD to display on my website.

Everything was working fine before the API update on May 1st, but now it wont even work with the required token

I’m not a PHP coder, but I suspect that

  • your second call to curl_setopt is overwriting the first
  • you need to specify both Client-ID and Authorization headers in a single call, something like
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Client-ID: ' . $clientID, 'Authorization: Bearer ' . $token]);

Ah, so thats what I was dong wrong.
Thanks

Yeah, this bit of code doesn’t add two headers.
It adds an array of one header, then overrides that header with an array of one header.
So you get one header.

So both headers go in one array and you call setopt with CURLOPPT_HTTPHEADER once with the full array of headers

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