python-social-auth icon indicating copy to clipboard operation
python-social-auth copied to clipboard

Tornado / Google 403 on auth complete

Open ksavenkov opened this issue 11 years ago • 2 comments

I have Facebook and VK backend working properly for Tornado framework. When trying to connect with Google+, I have 403 with the stack trace listed below.

The redirect URI is set to http://myapp.com:8000/complete/google-oauth2/? (that's what Google asked to set it to).

[E 150120 00:30:54 web:1407] Uncaught exception GET /complete/google-oauth2/?state=xceiQDjcWYtvtbOdy5FSieQ4qcObMjKv&code=4/AhNK2A-vKbFqila0ODhrcvFOUYis-6ppNPrneZnXkw.gggDe6_LCsAerjMoGjtSfTqonDkIlgI&authuser=0&num_sessions=4&prompt=consent&session_state=6373f80c01eb47d5d031668530cb0340032ec7cd..9762 (127.0.0.1) HTTPServerRequest(protocol='http', host='myapp.com:8000', method='GET', uri='/complete/google-oauth2/?state=xceiQDjcWYtvtbOdy5FSieQ4qcObMjKv&code=4/AhNK2A-vKbFqila0ODhrcvFOUYis-6ppNPrneZnXkw.gggDe6_LCsAerjMoGjtSfTqonDkIlgI&authuser=0&num_sessions=4&prompt=consent&session_state=6373f80c01eb47d5d031668530cb0340032ec7cd..9762', version='HTTP/1.1', remote_ip='127.0.0.1', headers={'X-Chrome-Uma-Enabled': '1', 'Accept-Language': 'en-US,en;q=0.8,ru;q=0.6', 'Accept-Encoding': 'gzip, deflate, sdch', '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', 'Connection': 'keep-alive', 'Cookie': 'vk-oauth2_state="2|1:0|10:1421701563|15:vk-oauth2_state|44:RVE3ek5XMzZqWVc5Y1JnelgzVVRUTmdsa3lYaTZGbW4=|09a8d2968cd39f26524c982a187d5d1a1761bfb4d44886063f6c3ceba88455b4"; social_auth_last_login_backend="2|1:0|10:1421701567|30:social_auth_last_login_backend|12:dmstb2F1dGgy|2e381bbe906d1b1a582e703af2f9204f76782f04159e34a51b9f922b2a8c6047"; user_id="2|1:0|10:1421701567|7:user_id|4:Mw==|bf745732e15d2a8a5ae1e2f9bcdca8027eadb672c40cc579e7ad2b03150f0d30"; google-oauth2_state="2|1:0|10:1421702838|19:google-oauth2_state|44:eGNlaVFEamNXWXR2dGJPZHk1RlNpZVE0cWNPYk1qS3Y=|9703a80d0c1ff2b846cc68fe0e3945a21b17946b53f8bbea16d231d6a82bdc8f"; partial_pipeline="2|1:0|10:1421703042|16:partial_pipeline|0:|7395032677e97c53d32bda46eb3fb9d4c471de6748db3f843f9186f75a9b89cf"', 'Cache-Control': 'max-age=0', 'X-Client-Data': 'CIi2yQEIorbJAQiptskBCMG2yQEI8YjKAQjFlMoB', 'Allow-Chrome-Signin': '1'}) 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 377, in auth_complete _args, *_kwargs) File "../../social/backends/oauth.py", line 381, in do_auth data = self.user_data(access_token, _args, *_kwargs) File "../../social/backends/google.py", line 74, in user_data 'alt': 'json' File "../../social/backends/base.py", line 228, in get_json return self.request(url, _args, *_kwargs).json() File "../../social/backends/base.py", line 224, in request response.raise_for_status() File "/Users/savenkov/Fun/myapp/python-social-auth/examples/tornado_example/tornado-social/lib/python2.7/site-packages/requests/models.py", line 831, in raise_for_status raise HTTPError(http_error_msg, response=self) HTTPError: 403 Client Error: Forbidden [E 150120 00:30:54 web:1811] 500 GET /complete/google-oauth2/?state=xceiQDjcWYtvtbOdy5FSieQ4qcObMjKv&code=4/_AhNK2A-vKbFqila0ODhrcvFOUYis-6ppNPrneZnXkw.gggDe6_LCsAerjMoGjtSfTqonDkIlgI&authuser=0&num_sessions=4&prompt=consent&session_state=6373f80c01eb47d5d031668530cb0340032ec7cd..9762 (127.0.0.1) 3261.93ms

ksavenkov avatar Jan 19 '15 21:01 ksavenkov

Did you manage to solve this?

po5i avatar Jun 07 '15 14:06 po5i

This may help http://stackoverflow.com/questions/24377506/httperror-403-forbidden-with-django-and-python-social-auth-connecting-to-googl

po5i avatar Jun 07 '15 14:06 po5i