Hello there! I’m using the twitch api v5 with python & flask to try to authenticate
This is the following code i’m using:
from flask import Flask, abort, request
app = Flask( name)
@app.route(’/’, methods =[‘GET’])
request2 = requests.get(' https://api.twitch.tv/kraken/oauth2/authorize?’+
@app.route(’/sessions/new’, methods = [‘POST’])
I added the last two routes because it was showing me a 404 before and now its allowing the twitch login to show the “sending…” button, but not really sure what to do now. Its not redirecting to allow the user to authenticate, just staying at the current login screen.
You are redirecting the user to Twitch at this step? Not getting and rendering the HTML?
Step 1 of oAuth is to actually send the user to Twitch?
I highly doubt you have access to VHS so this scope is likely useless for you!
request2 = requests.get(‘
that request2 = requests.get is actually doing the get and when returning the request2.text, it is displaying the twitch login html page from twitch.
i’m just following the instructions from the v5 docs and i’m just lost at this point. Can’t seem to get past part 1.
Looks like an error in the Docs
OAuth Authorization Code Flow (User Access Tokens)
Use this request:
?client_id=<your client ID>
&redirect_uri=<your registered redirect URI>
&scope=<space-separated list of scopes>
It should be:
"Redirect the user to this URL via GET"
Edit: was about to flag this to the devs… but I already did…
oh, so i have to redirect the user to this GET url instead for it to work?
Yes (as apposed to redirecting a user via post with a form or something)
Tried the way you described and this page isn’t doing anything at all
I don’t think that will work since you are just making a GET request and dumping the output to the user. (I could be wrong since I am not familiar with Flask)
Try issuing a HTTP redirect to the URL instead so the user can login and complete the authentication process. Once they complete it will redirect back to your app at your redirect_uri.
you mentioned redirecting to the URL.
What exactly are you referring to when you say URL? the get request URL? the ‘/’ route, or http://localhost
thank you George!!!
i did return return redirect(request2.url) and then the page worked and now i’m returned to the following:
which this is exactly what is documented in the twitch v5 documentation. Now I need to figure out what to do next with that since currently its the lost page. But glad i’m over the hurdle of not getting any further on the login
Btw. there is a reason why it’s called “Client Secret”, you just leaked a lot of things other people could use to use your bot’s data. Maybe you should remove the picture completely or reupload it censored.
thanks lol, forgot about that
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.