使用 django-allauth 通过 Stripe Connect 对用户进行身份验证。似乎连接到 Stripe 并允许登录,但是当返回到我的网站时,它会呈现一个 allauth 错误模板,上面写着:
An error occurred while attempting to login via your social network account.
关于我在这里做错了什么的任何想法?
这是我所做的。
设置.py
INSTALLED_APPS = [
...
'allauth',
'allauth.account',
'allauth.socialaccount',
'allauth.socialaccount.providers.stripe',
...
]
AUTHENTICATION_BACKENDS = [
...
'allauth.account.auth_backends.AuthenticationBackend',
...
]
SITE_ID = 1
网址.py
urlpatterns = [
...
url(r'^accounts/', include('allauth.urls')),
...
]
登录.html
{% if user and not.is_anonymous %}
<h2>Hello, {{ user.get_full_name }}.</h2>
{% else %}
<p><a href="{% provider_login_url 'stripe' %}" class="btn btn-default">Stripe</a></p>
{% endif %}
条纹连接
Website URL: https://127.0.0.1:8000
Redirect_URIs: http://127.0.0.1:8000/accounts/stripe/login/callback/
按照文档在 django admin 中设置社交应用程序,如下所示:
Social Applications = http://127.0.0.1:8000/