python - Missing OAuth request token cookie error using tornado and TwitterMixin -


i'm using tornado , twittermixin , use following basic code:

class oauthtwitterhandler(basehandler, tornado.auth.twittermixin):      @tornado.web.asynchronous      def get(self):          if self.get_argument("oauth_token", none):              self.get_authenticated_user(self.async_callback(self._on_auth))              return          self.authorize_redirect()      def _on_auth(self, user):          if not user:              raise tornado.web.httperror(500, "twitter auth failed")          self.write(user)          self.finish()  

for me works sometimes, users of application 500 error says: missing oauth request token cookie

i don't know if comes browser or twitter api callback configuration. i've looked through tornado code , don't understand why error appears.

two reasons why might happen:

  1. some users may have cookies turned off, in case won't work.
  2. the cookie hasn't authenticated. it's possible oauth_token argument set, cookie not. not sure why happen, you'd have log logging understand why.

at rate, isn't "error," rather sign user isn't authenticated. maybe if see should redirect them authorize url , let them try again.


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -