Authenticate from game

I want to get a channel subscribers list to facilitate in interactive streaming.
As I understand Twitch-API/Authentication tells how to authenticate in browser. But how can I do this without any browser context? The game is native (Steam) program.

Do I need to setup a service like this http://www.twitchapps.com/tmi/ and ask user to paste the token? (We already ask a token for chat).

Or maybe it is possible to make a request to https://api.twitch.tv/kraken/oauth2/authorize and process it using just curl library? I dont know a lot about this stuff. “They will be redirected to the following URL” - does it mean it will be http response which I need to interpret?

You shouldn’t have to set up a service to paste the token. Authentication is all done through OAuth 2.0, which uses HTTP for all of the requests. A lot of developers use the PHP implementation of cURL to handle authentication, so it is possible to use a cURL library if available.

I am curious. How are you asking for the token for chat? You could make one token request for both scopes instead of multiple requests.

The game can handle everything else via normal HTTP libraries, but the user does need a browser during the authorization flow. Depending on the game, the easiest option might just be to have a separate small desktop program that will handle the auth flow and save the token for the game to use. That will avoid having to tab out of the game to the browser and having to implement a browser within the game client.

1 Like

I simply point to your instruction for setting up irc http://help.twitch.tv/customer/portal/articles/1302780-twitch-irc
Then user is supposed to keep that oauth:password and enter it in game settings.

I see the benefit of having just one token for all scopes but it requires different approach which I am trying to figure.

You said curl can handle authentication. Can you outline the process?
Should I begin as described in Implicit Grant Flow or elsewhere?
If I send request to api.twitch.tv/kraken/oauth2/authorize what is the response - html page?

That is what I am afraid of. Looks too complicated, but thanks.

@3ventic is correct that you need a browser for the initial OK by the user. The response from https://api.twitch.tv/kraken/oauth2/token is a JSON-encoded token. Just FYI, @shekhjkl, I’ve sent you a private message to talk offline about these sort of pain points. :smile:

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