Confused about how the OAuth token works

It’s the first time that I work with an API like the Twitch one.
I try to retrieve informations about a specific streamer live statue.

All I want is to know if he is streaming, and if yes what is the title.
From what I found I am convinced that I should use this:

I created an application, so now I have a client ID, but now I need an OAuth token. How to get it ?
The only thing related to this on my application panel is “OAuth Redirect URLs”. What is it supposed to be ?
Here is how my php script looks like:


$ch = curl_init('');

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Client-ID: bsqaagd3f2pgr0z7h3siw06l0j6bbk'

$r = curl_exec($ch);


It returns ‘{“error”:“Unauthorized”,“status”:401,“message”:“OAuth token is missing”}’

How to make this works simply as it should be ?

I’m pretty sure that it is but i don’t get it :sweat_smile:

(It scares me to know that soon I’ll implement an authentification method using the same API)

Thank you

Given you don’t have a user token.

It probably makes sense to generate and use an App Access/Server to Server/Client Credentials token

Generate and store it and make a new one when it expires/is close to expire

1 Like

Thank you very much.

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