-
-
Notifications
You must be signed in to change notification settings - Fork 890
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flask-socketio + Flask-Login/Flask-OpenID trouble #82
Comments
I'm going to guess that this problem is caused by an incompatibility between the gevent web server and the python-openid package. Have you tried adding monkey patching? That might help, just add the following at the top of your main Python script:
Make sure this is done above any other imports, put them in lines 1 & 2 above everything else. |
It has been almost 2 weeks but I finally got a chance to make a serious effort to reincorporate python-openid (free time projects, you know). Just for reference, monkey patching did not work for me. Nor did changing the form to use GET. I doubt I will get this solved since I have made so little headway myself and python-openid may basically be abandoned. It seems the best solution for now is not to use that in conjunction with this or at all. |
It's unfortunate, but yes, there's probably no easy solution other than debugging python-openid when used with gevent. |
This example works just fine with socketio: https://github.com/mitsuhiko/flask-openid/blob/master/example/example.py You can just replace the app.run with this: from flask.ext.socketio import SocketIO
socketio = SocketIO(app)
if __name__ == '__main__':
init_db()
app.auto_reload = True
socketio.run(app, host='0.0.0.0', port=8082) And you'll need to update the sqlalchemy commit() stuff, but the OpenID aspect works just fine. |
I am trying to use the above in combination, and switching to a configuration that starts the gevent-socketio worker seems to have broken my otherwise working login.
Here is my login setup, taken almost directly from your Mega-Tutorial
When I start the server using the app.run() method, this all works normally. Switching to either socketio.run(app) or gunicorn --worker-class socketio.sgunicorn.GeventSocketIOWorker module:app causes the form POST to get turned into a GET request, which never validates because it is missing 'openid' and 'csrf_token'.
Update
Removing flask-openid works around this, although this not a great long-term solution in my case. (At least, I may have to find something to replace it.) I believe the problem is in @oid.loginhandler decoration but I have not looked into it.
The text was updated successfully, but these errors were encountered: