Search code examples
pythondjangostripe-paymentsdjango-allauthstripe-connect

django-allauth redirect url says "Login Failure" with Stripe OAuth


Using django-allauth to authenticate user with Stripe Connect. Seems to connect to Stripe and allow for login, but when returned to my website it renders an allauth error template which says:

 An error occurred while attempting to login via your social network account.

Any ideas on what I've done wrong here?

Here is what I've done.

settings.py

INSTALLED_APPS = [
                  ...
                  'allauth',
                  'allauth.account',
                  'allauth.socialaccount',
                  'allauth.socialaccount.providers.stripe',
                   ...
                  ]

AUTHENTICATION_BACKENDS = [
                           ...
                           'allauth.account.auth_backends.AuthenticationBackend',
                           ...
                           ]

SITE_ID = 1

urls.py

urlpatterns = [
               ...
               url(r'^accounts/', include('allauth.urls')),
               ...
              ]

login.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 %}

Stripe Connect

Website URL: https://127.0.0.1:8000

Redirect_URIs: http://127.0.0.1:8000/accounts/stripe/login/callback/

set up the social application in the django admin as follows per the docs:

Social Applications = http://127.0.0.1:8000/

Solution

  • ooops. I was using the Client_ID instead of the API Secret Key from Stripe Connect Dashboard in the allauth admin social applications fields.