Hey guys so this my first post here and I may be trying to bite off more then I can chew, but that’s totally fine because I am up for the challenge. So I am working on making a personal site for my viewers to go to and keep up to date with everything, my stream has a point system integrated into it and one thing I was hoping to do with the API was create a twitch connect button on my site. So when someone connects their account by clicking the button I just grab their user name and I cross reference their user name to my google spread sheet and see how many points they have and display it.
But the first step is just getting the user able to connect with twitch to grab their user info. I’ve been messing with some of the html api from (https://github.com/justintv/twitch-js-sdk/blob/master/test/integration.html). I’ve been using the test script but it seems not to do anything, so I’m just curious on how you do this.
If your a little confused on what I am trying to accomplish here just take a peak at cowsep.com I am looking to do a login like he does.
My recommendation would be upload that all to a MyPHP Database, then have them sign in via Twitch and when the username is connected have it display points for example $twitchpoint = $twitchusername and have that connect to your db.
Cool thanks for the reply, my only issue I still have would be how to allow them to sign into twitch via my site. Which I’m not sure how to accomplish with the API.
You;d to setup oauth to signup or signin via twitch on your site,. If you don’t how to do that id recommend you get a little more knowledge on either php or whatever syntax you are using.
No offense to you but you seem a little new to coding i’d recommend you either hire or have a friend whos better at this to help you.
You can reach out to me I am here but don’t check the dev side on twitch often
Hey thanks for the help I’m going to look into all the stuff you just listed thanks for pointing me in the right direction with it!
No problem brother, glad I could hopefully bring you success, either way feel free to reach out to me any time
I recommend you check out the following link, it details the process behind authenticating a user for your application (in this case, your site):
- First you need to figure out where on your site they’ll be redirected back to after they approve the request you make; this is the URL you’ll need to specify it when your register your new application.
Register your application. You can see some examples in your own Twitch connection settings. This is what allows your site to make the requests. If they approve your request, your application will show up in their connections list as an approved connection.
- When you’re ready to make the request, you’ll direct them to an api.twitch.tv URL where they confirm that they want to give your application permission to access their profile. They’ll be able to see what scopes / permissions you’re requesting access for (email, subscriptions, etc), so only request the bare minimum scopes you require (or even none if all you need is their account name).
- After they click the button to approve, Twitch will send them and a code back to your URL from step 1. This is just a code that approves your application to request OAuth tokens for their account; it basically just says they’ve approved your application, but doesn’t let you access any information yet.
- At this point, the user has done everything they need to; all API requests from this point on will be performed solely by your server. Use this code to ask the Twitch API for an OAuth token, using the code you got back.
- This time, you’ll get an OAuth token back; this is the code you’ll be using to actually talk to the Twitch API get their account name.
- You can use the OAuth token to make an API request to api.twitch.tv/kraken. You’ll get back JSON encoded data, within will be
token.user_name as a string.
- Now that you know their Twitch username and have confirmed their identity, just look up their points in your chat bot’s database.
Obviously these are just the basic steps, you’ll still need to check the documentation (my first link at the very top) for exactly how to perform each request, as well as registering a new application with Twitch and setting up the coding on your site (keeping the user authenticated on your site throughout the process, saving the information you get back from the API, handling access between your web server and your chat bot’s database, etc.).
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.