【问题标题】:Python Social Auth ErrorPython 社交身份验证错误
【发布时间】:2021-01-07 13:08:09
【问题描述】:

我正在使用 Python Social Auth 包来使用 Google OAuth 服务。它在我的本地机器上运行良好。但是,当我在 VM linux 机器上部署应用程序时,出现以下错误:

AuthFailed at /complete/google-oauth2/

Authentication failed: HTTPSConnectionPool(host='accounts.google.com', port=443): Max retries exceeded with url: /o/oauth2/token (Caused by <class 'socket.gaierror'>: [Errno -2] Name or service not known)

Exception Type:     AuthFailed
Exception Value:    Authentication failed: HTTPSConnectionPool(host='accounts.google.com', port=443): Max retries exceeded with url: /o/oauth2/token (Caused by <class 'socket.gaierror'>: [Errno -2] Name or service not known)

有人可以帮帮我吗?提前致谢。

【问题讨论】:

  • 您的虚拟机似乎无法访问端口 443 (https),您可以在该虚拟机中执行wget https://accounts.google.com 吗?

标签: python django python-social-auth


【解决方案1】:

我最近使用相同的包进行测试并且遇到了同样的问题。

如果您使用 http://127.0.0.1:8000 访问您的服务器,请将其替换为 http://localhost:8000/,后跟您的 URL 路径

Google 需要 HTTPS 请求,因此使用 localhost 将代表开发服务器

这已经为我解决了这个问题。我从这里遇到了这个解决方案https://youtu.be/wlcCvzOLL8w

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-04
    • 1970-01-01
    • 2015-01-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多