Twitter / Tornado "Wrong state parameter given"
Sorry if this is some type of lame bug in my code. I am not an expert in oauth. I use Tornadp example provided with the repo. The authorisation is successfully started, I got redirected to the twitter connect page, but after clicking "Sign In" I got 500 with the following stack trace:
[I 150119 21:20:53 web:1811] 302 GET /login/twitter (127.0.0.1) 1393.70ms [E 150119 21:21:00 web:1407] Uncaught exception GET /complete/twitter/?redirect_state=WyEyOjH7mCXRTtNEMpAw9LY1tFjEa8NY&oauth_token=uN14aAyXi42bqOHfs6ttlpTir7Gk6WBD&oauth_verifier=bFHSORVyjTyHfj4P6718vNpjq1s6dYVS (127.0.0.1) HTTPServerRequest(protocol='http', host='myapp.com:8000', method='GET', uri='/complete/twitter/?redirect_state=WyEyOjH7mCXRTtNEMpAw9LY1tFjEa8NY&oauth_token=uN14aAyXi42bqOHfs6ttlpTir7Gk6WBD&oauth_verifier=bFHSORVyjTyHfj4P6718vNpjq1s6dYVS', version='HTTP/1.1', remote_ip='127.0.0.1', headers={'Connection': 'keep-alive', 'Accept-Language': 'en-US,en;q=0.8,ru;q=0.6', 'Accept-Encoding': 'gzip, deflate, sdch', 'Cookie': 'twitter_state="2|1:0|10:1421691653|13:twitter_state|44:eVZGajI4WXJWMWg0cWJ4a09UakxSdE1kZzlJZDZOZHk=|4f6545f6839f605fc5996f23c8de0500b38fadd2678c615252eb37759901de2f"; twitterunauthorized_token_name="2|1:0|10:1421691653|30:twitterunauthorized_token_name|176:W3Unb2F1dGhfdG9rZW49dU4xNGFBeVhpNDJicU9IZnM2dHRscFRpcjdHazZXQkQmb2F1dGhfdG9rZW5fc2VjcmV0PUt5TzBqZ0ZkVVVib09QdlRTUDVkZFRxaTl3d0VxM2FBJm9hdXRoX2NhbGxiYWNrX2NvbmZpcm1lZD10cnVlJ10=|3cab9e6bcd116512b82a85819efa7dd4dd827c2bb087f0a62000182adb771562"; partial_pipeline="2|1:0|10:1421691652|16:partial_pipeline|0:|12f70b272648e6bda22eb0db637f2d016b4d758b0ba05f98e2d5d063628ffb1d"', 'Host': 'myapp.com:8000', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8', 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.99 Safari/537.36'}) Traceback (most recent call last): File "/Users/savenkov/Fun/myapp/python-social-auth/examples/tornado_example/tornado-social/lib/python2.7/site-packages/tornado/web.py", line 1332, in _execute result = method(_self.path_args, *_self.path_kwargs) File "../../social/apps/tornado_app/handlers.py", line 34, in get self._complete(backend) File "../../social/apps/tornado_app/utils.py", line 42, in wrapper return func(self, backend, _args, *_kwargs) File "../../social/apps/tornado_app/handlers.py", line 44, in _complete user=self.get_current_user() File "../../social/actions.py", line 40, in do_complete user = backend.complete(user=user, _args, *_kwargs) File "../../social/backends/base.py", line 40, in complete return self.auth_complete(_args, *_kwargs) File "../../social/backends/oauth.py", line 167, in auth_complete self.validate_state() File "../../social/backends/oauth.py", line 83, in validate_state raise AuthStateForbidden(self) AuthStateForbidden: Wrong state parameter given. [E 150119 21:21:00 web:1811] 500 GET /complete/twitter/?redirect_state=WyEyOjH7mCXRTtNEMpAw9LY1tFjEa8NY&oauth_token=uN14aAyXi42bqOHfs6ttlpTir7Gk6WBD&oauth_verifier=bFHSORVyjTyHfj4P6718vNpjq1s6dYVS (127.0.0.1) 15.63ms