【问题标题】:Django, django-allauth and the battlenet providerDjango、django-allauth 和战网提供者
【发布时间】:2017-03-18 19:45:23
【问题描述】:

第一次尝试将 oauth 与 python django 和 django-allauth 一起使用。我似乎无法进行登录。我可以达到要求您使用战网授权您的网站的地步,但是当您被重定向到回调 url 时,我只会得到以下信息:

{'code': 'unknown', 'provider': 'battlenet', 'exception': ProxyError(MaxRetryError("HTTPSConnectionPool(host='us.battle.net', port=443): Max retries exceeded with url: /oauth/token (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 403 Forbidden',)))",),)}

我已经在 dev.battle.net 中创建了我的应用程序,我已经将客户端密钥和密钥放在了我的 django-allauth 应用程序中,但我现在卡住了。

有人有这方面的经验吗?

【问题讨论】:

    标签: django oauth-2.0 django-allauth


    【解决方案1】:

    我设法回答了我自己的问题。

    我现在正在使用 pythonanywhere 来托管它,并且我使用的是免费服务。如果您是免费用户并且 us.battle.net 不在列表中,似乎有一个可以点击的网址白名单。我注册了一个月,几分钟后我的 oauth 调用工作正常。

    如果其他人碰巧遇到我的情况,这里是 pythonanywhere 可以免费访问的网站列表。

    https://www.pythonanywhere.com/whitelist/

    【讨论】:

      【解决方案2】:

      您正在运行哪种代理? Nginx + Gunicorn?它试图点击'/oauth/token'并失败了。我刚刚在 Battle.net 上设置了一个 allauth,但一路上我没有看到这一点。

      你的 urls.py 和 settings.py 是什么样的?

      • 您需要在设置文件中指定 SITE_ID。
      • 确保您的反向代理正在处理 https 请求。

      【讨论】:

      • 原来是 pythonanywhere 阻止了我作为免费用户。感谢您抽出宝贵时间发表评论。
      • 很高兴你明白了! :)
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-02-23
      • 2022-11-02
      • 2020-08-04
      • 2013-01-09
      • 2014-08-30
      • 2016-06-04
      相关资源
      最近更新 更多