justintv / Twitch-API

A home for details about our API
www.twitch.tv
1.72k stars 381 forks source link

Game Plugin Getting Channel Subscriber issue #619

Open int128fly opened 7 years ago

int128fly commented 7 years ago

Hi twitch api community, I have no idea where to post this sorry if I am in the wrong place.

I am making a plugin for the game rust that give certain in-game 'kits' to subscribers for a channel. So currently when the player is connecting to the server I am making a call to the twitch API to find out their twitch account by providing the steamid.

My issue with that, from what I understand, the API request me to make the user login with the twitch oauth to get a token to be able to fetch some data which I need to look if the user is subscribe to the channel. As you can see in my situation I am limited and I don't see any solution to my problem and it seem to be a twitch API limitation that I cannot detour.

Please somebody help me ;(

sources: https://github.com/justintv/Twitch-API/blob/master/authentication.md https://github.com/justintv/Twitch-API/blob/master/v3_resources/subscriptions.md#get-usersusersubscriptionschannel

API call to find the twitch account from steamid: https://api.twitch.tv/api/steam/

bashtech commented 7 years ago

The first two endpoints listed on the doc page you linked use the authorization of the channel owner so you will only need to generate a token for that account and not each user on the server. On Fri, Sep 23, 2016 at 5:38 AM int128fly notifications@github.com wrote:

Hi twitch api community, I have no idea where to post this sorry if I am in the wrong place.

I am making a plugin for the game rust that give certain in-game 'kits' to subscribers for a channel. So currently when the player is connecting to the server I am making a call to the twitch API to find out their twitch account by providing the steamid.

My issue with that, from what I understand, the API request me to make the user login with the twitch oauth to get a token to be able to fetch some data which I need to look if the user is subscribe to the channel. As you can see in my situation I am limited and I don't see any solution to my problem and it seem be twitch API limitation that I cannot detour.

Please somebody help me ;(

sources: https://github.com/justintv/Twitch-API/blob/master/authentication.md

https://github.com/justintv/Twitch-API/blob/master/v3_resources/subscriptions.md#get-usersusersubscriptionschannel

API call to find the twitch account from steamid: https://api.twitch.tv/api/steam/

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/justintv/Twitch-API/issues/619, or mute the thread https://github.com/notifications/unsubscribe-auth/AAG3vBpM2boQhjppjZVfRmiYg3TeLpiwks5qs54JgaJpZM4KEyg2 .

int128fly commented 7 years ago

Don't I need to make the owner of the channel login with oauth so they can authorize my application to fetch the information? How am I suppose to do that in my plugin?

Is there a way to make the channel owner authorize the application in an other way? If the application is owned by the channel owner does the application grant automatically access to that user/channel information?

EDIT: https://gyazo.com/913a2669d3065a15d549f7dd9fcae6ff How can I make that happen without having a webhost or sent twitch login screen to the channel owner?

bashtech commented 7 years ago

Create a small login webpage that uses one of the grant flows to generate a token and have them provide it to you (or enter it into the plugin confit if they are setting up the plugin themselves). Tokens don't expire so you only have to do it once. On Fri, Sep 23, 2016 at 6:45 AM int128fly notifications@github.com wrote:

Don't I need to make the owner of the channel login with oauth so they can authorize my application to fetch the information? How am I suppose to do that in my plugin?

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/justintv/Twitch-API/issues/619#issuecomment-249160041, or mute the thread https://github.com/notifications/unsubscribe-auth/AAG3vFnoX2a-YIRXvpmZ3BxPns2rieWYks5qs63KgaJpZM4KEyg2 .

int128fly commented 7 years ago

Ok I think i see how to do it.

int128fly commented 7 years ago

Hi again,

sorry to bring my issue here but as you know I have to do the login and authorization process in the background with the streamer username/password. I played with the chrome extension "Advanced REST client" trying to figure out how to make it work but I always end up with a error 400 when I try to login with the information: https://gyazo.com/55be51034e7cb0d832fef5687f8ce3dc. Yes I did put my real username and password and used the nounce that I receive with this: https://gyazo.com/5ab42df17318b0bbcc3e4cba2645d059 & https://gyazo.com/17753ba33d062fe3f2b07ea4f2f86d0f I just wonder what could be the issue, am I on the right track or what I am doing is completely useless.

link used to authorize application: https://api.twitch.tv/kraken/oauth2/authorize?client_id=rnqmxy7pouav1famwsj3ty4nnbmpoky&redirect_uri=http%3A%2F%2Flocalhost&response_type=token&scope=channel_subscriptions&state=

3ventic commented 7 years ago

Do not ask for other user's passwords. Have them authorize the application.

int128fly commented 7 years ago

It a game plugin that streamers can install on their servers but there is no webhost or website so basically my plugin configuration will ask for their password and username to grant authorization and clear the configuration afterward since it only needed once. it a oxide plugin coded in C#, oxide enforce plugins to be open source (you install the source in the server and it auto compile it)

It just I am limited to this because there is no other way to authorize my application (which will actually be who ever install the plugin will need to create his own twitch application)

3ventic commented 7 years ago

NEVER request Twitch user passwords.

https://www.twitch.tv/p/developer-agreement

glacials commented 7 years ago

@int128fly, you just posted a screenshot including your Twitch username and password. You will want to change those immediately.

int128fly commented 7 years ago

@glacials which one?

edit: nvm im an idiot alrite thank you

3ventic commented 7 years ago

The first one.