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);
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 Getting OAuth Access Tokens | Twitch Developers
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