简体   繁体   English

使用python-social-auth的django社交认证错误

[英]django social authentication error using python-social-auth

I am following this answer which is very clear and helpful, i have configured all the settings, but after login using gmail when i am redirected to localhost:8000/soc/complete/google-oauth2/?state=jAwzw... .我正在关注这个非常清晰且有用的答案,我已经配置了所有设置,但是在使用 gmail 登录后,当我被重定向到localhost:8000/soc/complete/google-oauth2/?state=jAwzw... I am getting this error我收到此错误

HTTPError at /soc/complete/google-oauth2/
403 Client Error: Forbidden for url: https://www.googleapis.com/plus/v1/people/me?access_token=ya29..wwKoNcTfjGshqc8UYfdziBbgVtYP4bgBZ9ehrfsHJjfs-v6Cy2X3ULsdh_rJwbfApw&alt=json
Request Method: GET
Request URL:    http://localhost:8000/soc/complete/google-oauth2/?state=jAwzw3EhdvFdUCv2DFia8fN4n7tUic6u&code=4/nvOb3r-U-ZXrxFCT1dSKcTE2wR8MbxhonRWX60cP4-0&authuser=0&session_state=e8244f9ad9dec2b21c83e2b153a6e9595ccefac4..e292&prompt=consent
Django Version: 1.8.1
Exception Type: HTTPError
Exception Value:    
403 Client Error: Forbidden for url: https://www.googleapis.com/plus/v1/people/me?access_token=ya29..wwKoNcTfjGshqc8UYfdziBbgVtYP4bgBZ9ehrfsHJjfs-v6Cy2X3ULsdh_rJwbfApw&alt=json
Exception Location: /usr/local/lib/python2.7/dist-packages/requests/models.py in raise_for_status, line 840
Python Executable:  /usr/bin/python
Python Version: 2.7.6
Python Path:    
['/home/aditya/django/myapp/socialapp',
 '/usr/lib/python2.7',
 '/usr/lib/python2.7/plat-x86_64-linux-gnu',
 '/usr/lib/python2.7/lib-tk',
 '/usr/lib/python2.7/lib-old',
 '/usr/lib/python2.7/lib-dynload',
 '/usr/local/lib/python2.7/dist-packages',
 '/usr/lib/python2.7/dist-packages',
 '/usr/lib/python2.7/dist-packages/PILcompat',
 '/usr/lib/python2.7/dist-packages/gtk-2.0',
 '/usr/lib/pymodules/python2.7',
 '/usr/lib/python2.7/dist-packages/ubuntu-sso-client']
Server time:    Wed, 13 Apr 2016 11:33:21 +0000

I am not sure about the SOCIAL_AUTH_PIPELINE settings, i have just copied them , which are like我不确定SOCIAL_AUTH_PIPELINE设置,我刚刚复制了它们,就像

SOCIAL_AUTH_PIPELINE = (
    'social.pipeline.user.create_user',
    'social.pipeline.social_auth.social_user',
    'social.pipeline.social_auth.associate_user',
    'social.pipeline.social_auth.load_extra_data',
    'social.pipeline.user.user_details',
)

Can you please explain whats the issue and how exactly this SOCIAL_AUTH_PIPELINE works ?你能解释一下问题是什么以及这个SOCIAL_AUTH_PIPELINE究竟是如何工作的吗?

问题已解决,刚刚启用了 Google+ API,谢谢@ddalu5

For all those people that have the same issue, one alternative to solve it is to update the package.对于所有遇到相同问题的人,解决此问题的一种替代方法是更新软件包。 I have the problem in v1 and enabling Google+ doesn't solve it, but upgrading to v4 does.我在 v1 中遇到了问题,启用 Google+ 并不能解决它,但升级到 v4 可以。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM