Can't access live status with valid Client-ID

I am trying to just check the live status of a channel with the new API through C#, I found posts that my code should work but it still returns "401 unauthorized, OAuth Token is Missing. I dont even know what that is. Can anyone help?

RestClient client = new RestClient();
RestRequest request = new RestRequest("https://api.twitch.tv/helix/streams?channel=lolakizz");
client.AddDefaultHeader("Client-ID", "<clientid>");
Console.WriteLine(client.Get(request).Content);

As per the changes to the OAuth requirements for Helix Requiring OAuth for Helix Twitch API Endpoints you need to send an Authorization header containing your OAuth token.

The above link includes all details, including links to relevant pages in the documentation on how to create an OAuth token.

All the pages on how to recieve an OAuth Token tell me something among the lines of
id.twitch.tv/oauth2/(token or authorize), both of which dont return anything with any parameters.
What I’ve currently written there:
RestRequest auth = new RestRequest($"https://id.twitch.tv/oauth2/token?client_id={clientID}&client_secret={clientSecret}&grant_type=authorization_code");

That request you’re making is step 3 of the Auth Code flow, so it’ll do nothing for you without doing steps 1 and 2 first. Also you’re missing parameters.

These are 3 different Auth Flows https://dev.twitch.tv/docs/authentication/getting-tokens-oauth
The first 2 are for User Access tokens, the third for an App Access Token. If you’re making requests that don’t require user scopes, and are making requests on your server rather than in a frontend, the Client Credentials code flow is the process you should use.

That is the Client Credentials code flow url from that exact link, that exact example just filled with my Client Info. What do you mean with step 1 and 2? That page literally tells me:
step 1: GET Token from URL I used from the sample, which returns 404.

Edit: Oh its a POST… I feel dumb, will update if that worked, thanks

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