Hi I found a requirement on the Twitch App site to register an App you need an OAuth Redirect URL. I know what it is but how do I get one? Please, somebody, help me!
Update: I found a way to get the Redirect URL and now I have the token but what do I do with it? (For the OAuth Redirect URL put to do it put https://twitchapps.com/tokengen/ and there you should get the token)
You and me both bother! I have scouring this for days yet no one seems to have a really straight forward answer. Maybe you can work better than me with the information I know.
I know I was told you can use http://localhost as your redirect url.
I was also told you can use this website for the implicit code flow method: https://twitchapps.com/tokengen/
I tried putting the local host as in my redirect for my app and I tried going to that link and clicking âconnect to twitchâ but then it brought me over to my IIS and it didnât give me token! So I donât know what to do.
I know Oauth is used elsewhere but I never had to do this to get the token. For discord, I just clicked on a link that copied my token for me and then I was on the next steps. Here I have no clue what to do.
I hope you have better luck than me!
The Redirect URL is whatever you want it to be. Itâs where users will be redirect to when connecting to your app.
If you need to send users through the authentication process for your app, then youâll need a URL that is publicly accessible and a webserver setup to handle the process. If you just need to authenticate yourself (or donât need to use the Authentication process at all), just put in http://localhost as that will redirect you back to yourself.
I gave you the oAuth dance here
This website uses itâs own clientID and secret to create a token. You cannot use it, using YOUR clientID
As you must write the code to exchange the code for a token (when using OAuth Authorization Code Flow
as documented
If using implict make sure you set the right data when passing to /authorize
Again Discord is giving you a bot login token for running a bot, itâs not really a oAuth token
oAuth for implicit is noted here
If you donât plan to use oAuth in your App, set it to https://localhost
as it should say on the ClientID creator page
while writing this, I was able to get my token! I will explain in my next post belowâŚI hopefully I can add pictures??
I am leave my post below for Barry as I want him to know where I was coming from. I thank him so much man! (also sorry if it sounds rude. I am not trying to be or anything, its just some of it didnât make sense so I wanted to elaborate. Not like it matters now as I think I have my token.
I donât know how to qoute Barry so I am going to just copy and paste to answer him because I donât think we are on the same page:
Barry, you said -
âThis website uses itâs own clientID and secret to create a token. You cannot use it, using YOUR clientIDâ
That doesnât make sense. The website: (Twitch OAuth Token Generator) says specifically to, " You will need to first register an application in your Twitch account settings to obtain a Client ID and enter the Redirect URL below.
Client IDScopes List of available scopesRedirect URL: https://twitchapps.com/tokengen/
This application uses the implicit grant flow for the Twitch API to retrieve your token. This means that your token is only ever visible to your browser and not our server."
So you saying, âThis website uses itâs own clientID and secret to create a token. You cannot use it, using YOUR clientIDâ doesnât make sense when it says, " You will need to first register an application in your Twitch account settings to obtain a Client ID and enter the Redirect URL below."
Does what I wrote explain why I am confused as to what you are saying regrading that?
Here is another thing you said, " As you must write the code to exchange the code for a token (when using OAuth Authorization Code Flow
as documented"
I already did that man! Infact, that was the first thing I tried before someone from the Discord gave me the token link. Here is my exact code word for word in python
"import requests
params = (
(âclient_idâ, âizbr3e0woto5nlw13belle04zsrtvfâ),
(âredirect_uriâ, âhttp://localhost:3030â),
)
response = requests.get(âhttps://id.twitch.tv/oauth2/authorizeâ, params=params)
"
The problem is I donât get any reply back run it. It just runs, then goes to the next line without giving me anything. THAT IS WHY I tried the oauth token link which I thought would be used to give myself a token if I put in the localhost:3000 as my redirect link for my app.
Does that make sense? I tried writing code and I got no errors back for me to know where the issue is, so I went to try it graphically.
Now mind you, if I put in ârequests.get(âhttps://id.twitch.tv/oauth2/authorize?client_id=izbr3e0woto5nlw13belle04zsrtvf&redirect_uri=http://localhost:3000â)â It will give me a response of 200 which means it saw it my http request. However when I tried to write code to pull back my token (as you saw my python code above) nothing came out of my IDE 3.7. It just went to the next line and didnât give me a response. Maybe the code itself is off?
Another thing I noticed you posted, âAgain Discord is giving you a bot login token for running a bot, itâs not really a oAuth tokenâ
I apologize as I must have missed you saying that first time because I donât remember that. If that is the case, then its makes sense why this is hard; there has been no time before this that I ever needed Oauth and I am pretty sure the OP is the same. There should be a note under the redirect URL that says to put local host if you are making the app for just yourself. (Then again, that still wont help noobs like myself if they are using local host for there ftp server)
One other very important post you gave me is this," If you already have a webserver running on localhost, and havenât set it up to handle the OAuth process, then yeah it likely wont work as youâre doing other stuff on that port, so use a different one, for example http://localhost:3000 1 and try again.
You should get redirected back to that URL with various querystring parameters in the URL depending on what auth flow you used, eg,
http://localhost:3000?code=394a8bc98028f39660e53025de824134fb46313&scope=viewing_activity_read&state=c3ab8aa609ea11e793ae92361f002671
"
I tried port 3000 and it didnât give me anything but I will explain a little better.
I tried putting http:localhost:3000 in my python code so it came out like, "
import requests
params = (
(âclient_idâ, âizbr3e0woto5nlw13belle04zsrtvfâ),
(âredirect_uriâ, âhttp://localhost:3000â),
)
response = requests.get(âhttps://id.twitch.tv/oauth2/authorizeâ, params=params)
"
However that didnât give me any reply back from IDE 3.7. It just went to another line like I mentioned above. I know my python works because as I mentioned earler the get request came back with a 200 rsponse so I know it worksâŚI think my code is off maybe but it wont give me any errors for me to figure out where to go from there.
I also tried putting http://localhost:300 in the redirect URL on my app and tried using the token link Twitch OAuth Token Generator to try and give me a token (thinking it was going to give a token in the address link or something.) and nothing came up. while typing this I think I figure out my stupid issue. I will post it in a separate post so that the OP can know what I did.
That whole information above was for Barry. I wanted to make sure he knew I was trying and wasnât just ignoring him. He is so freaking helpful even though I am a noob and am probably frustrating. Still he has been patient and still answers even though its redundant. Thank you
Before I start again I did read this:
Yeah, I understand where you are coming from but I felt I had to do that. I had to force myself to keep asking everywhere I could because this is that important to me. So much so that I was willing to pay someone to give me my token just so I can work pas this. I NEED a channel update script and I would have paid for one if it exists. The fact that there isnât one on github I can just use means I need to step up my game and learn a bunch of stuff in programming that I donât normally come across. I knew importing and modules already but I never used Oauth in anything before so I just kept getting stumped.
BarryCarlyon (awesome person) Kept trying to help but none of it makes sense and I just randomly stumbled upon my token as I am such the idiot.
Also (as a side note) I am going to post what I said on the Discord developer channel when someone told me to go back to the basics of programming::
"Learning recursion doesnât help with oauth
learning programming doesnât help with making a twitch program api, the two things are just different. Learning the basics of programming doesnât show how to use any of the api for twitch or oauth. You have to learn those specific things. The only way I would have came across this is if I needed to use Oauth for another website and they didnât give me a link. Like I mentioned a day or two ago, Discord had a link for the token which made this alot easier. Its not like I had to learn the ful basics of a programming language to get my discord chat bot up and running and that is point there.
I have already done every single lesson in code academy for python. Does that mean I am going to know APIs, or Oauth? No way! That is the point, I have to go in head first and not know shit, till it starts making sense. If it was easier, I donât think I would have posted in here or on the twitch dev forums so much these last couple of days.
I have been working on my twitch for months and have been learning batch scripts for OBS and VLC, python scripts for my instagram , twitter and discord, and so far everything has been good for learning. Some stuff is fustrating but nothing a good google search and some determination canât solve. (plus common sense and the will to learn).
However twitch has been kicking my ass super tuff. I am embarrassed to say that I have a network certification after dealing with this crud⌠lol!"
My quote above is the reason I kept bothering this forum. I can spends days learning about programming which I did daily anyway However, I have NEVER came across OAuth. Me understanding programming and me understanding Oauth are two different things. Its like, you can understand how to make a program without knowing Oauth at all and that shouldnât stop me from making my script."
I will say this, if I do learn Oauth to a very good degree I am going to make a video tutorial that is very slow and graphical for ANYONE to atleast understand the concept of it so when they go back to there programming language of choice, they can just go from there. (atleast I hope I can teach that good. hahaha)
Ok here is what I did to get my token. I assume this is for yourself only and not for if anyone wants to use your botâŚI believeâŚIâm not super smart. lol
-
Make your bot app from here: https://glass.twitch.tv/console/apps
1b. Fill in the:
Name - (anything you want)
Category - (choose any category your bot applies to)
OAuth Redirect URL - (put in this link: https://twitchapps.com/tokengen/)
1c. Then click âsaveâ and afterwards you should your client id on that webpage as well. (you are going to need it) -
Open a new tab and go to the link: https://twitchapps.com/tokengen/
2b. Put your
client ID - (the one that was generated after you saved your app settings)
2c.(optional) You can put in scopes but I havenât used it yetâŚthe link on that page regarding scopes is busted but if you want to know more about scopes go here https://dev.twitch.tv/docs/authentication/#scopes (I should read more about it as well.)
2d. Click âconnect to twitchâ. -
If done right, you will be brought to an authorization page asking you to authorize your bot to do stuff on your behalf (obviously allow this or why are you here? lol)
-
Your token will be provided right after on the next page.
Man I am so stupid, the webpage wants you to put there redirect url in your app so it redirects there. OMG, iâm such an idiot.
Iâm not going to tackle the huge wall of text you posted, but I noticed a couple things worth mentioning.
First off, you make a GET request to the the auth url and then say nothing happens⌠Well, what do you expect to happen, have you programmed it do actually do anything with what you just requested? Also from what I can see of your code youâre not even providing all of the required parameters, such as response_type
. Read the docs to see what parameters you need to send.
Secondly, thatâs not even how OAuth works. You canât just do a GET request to the auth url as all that will happen is youâll get back the HTML from Twitch. For user access tokens you need to actually send the user to that URL so they go to it in their browsers, they will then see a Twitch page asking them to authorise your app, and if the do the userâs browser page will be redirected back to your redirect URL.
A lot of your issues are coming from your lack of understanding certain concepts, such as OAuth, HTTP requests, and things like that. You would be far better off trying to gain an understanding in the various pieces that are involved in utilising the Twitch API, and how to make use of them in your programming language by looking for specific modules, their documentation and guides on their use, rather than trying to brute force something together that works with Twitch without actually understanding how any of it works as you wont learn anything.
Well theres your problem.
You tried to GET the twitch login page, instead of redirecting the user to the login page.
As covered here, in your original post where I also touched on Discord
Oh and thread closed as @Sir_Cheese_123 is now totally sidetracked by @masterjx9 please open a new thread if you see need help sir_cheese