我在 Google 中使用 python-social-auth 的实现时遇到了困难。
我收到的错误是400: OpenID auth request contains an unregistered domain.
我检查并重新检查并要求另一位开发人员在 Google 开发人员控制台中检查项目的凭据,一切看起来都很好。
我在过去的一个 Django 项目中成功地使用了 python-social-auth,但是这一次解决了这个问题。
这个项目和上一个项目之间的唯一区别(据我所知)是:
- 此站点当前是子域 (
test.domain.com) - 它位于 Linode 负载均衡器后面——两个应用程序服务器通过静态 IP 响应均衡器,为域/子域配置了 nginx,并且我的 DNS 记录已更新。
我知道Google 正在弃用 OpenID,但通过设置配置为使用 OAuth2:
AUTHENTICATION_BACKENDS = (
'social.backends.open_id.OpenIdAuth',
'social.backends.google.GoogleOAuth2',
'social.backends.google.GoogleOAuth',
'social.backends.google.GoogleOpenId',
'social.backends.facebook.FacebookOAuth2',
'django.contrib.auth.backends.ModelBackend',
# custom password checker - migrating from old rails site, want to preserve old passwords
'auth.authentication.legacy_hasher.LegacyCustomerAuthBackend',
)
SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = os.environ.get('SOCIAL_AUTH_GOOGLE_OAUTH2_KEY', 'redacted-key')
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = os.environ.get('SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET', 'redacted-key')
有没有我错过的东西,或者我未能配置的东西?