[Answer]-How to use tornado authentication in a django view?

1👍

The tornado.auth module goes through the openid/oauth flow, but at the end of that process all it does is call back to your code where you probably set a cookie. You read that cookie in Tornado with get_current_user, but that’s specific to the Tornado RequestHandler interface. To use this cookie from django you’ll need to read the cookie yourself (see the tornado.web.decode_signed_value function, assuming you set the cookie with set_secure_cookie). You can either find the right place in the django framework to do this, in which case you may be able to use django’s login_required decorator, or you can just do it in your django handler in which case you’ll need to redirect to the login form on your own.

Leave a comment