Twitter auth ''Missing OAuth request token cookie"

220 views
Skip to first unread message

Thomas Leese

unread,
Jun 27, 2011, 3:02:37 PM6/27/11
to python-...@googlegroups.com
I have a twitter account handler and I keep getting the error "Missing OAuth request token cookie"

Here is the code for my account handler:

class AccountTwitterHandler(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()

I've looked through the tornado code and I don't understand why this error appears.

Ben Darnell

unread,
Jun 28, 2011, 2:12:22 AM6/28/11
to python-...@googlegroups.com
I think this is a sign that the callback url registered with twitter is on a different domain than what you're accessing in the browser.  Most often this is because you've registered hostname.foo.com with twitter, but you're accessing it in development as just "hostname" or "localhost".  

-Ben

Thomas Leese

unread,
Jun 28, 2011, 2:27:32 AM6/28/11
to python-...@googlegroups.com
That would make sense, yeah. I'll try that.
Reply all
Reply to author
Forward
0 new messages