0

This is my project's directory:

/handshakeapp:
    templates/
    __init__.py
    admin.py
    models.py
    pipelines.py
    views.py
/VKHandshake:
    __init__.py
    settings.py
    urls.py
    ...
manage.py

This is part of settings.py

SOCIAL_AUTH_PIPELINE = (
    'social.pipeline.social_auth.social_details',
    'social.pipeline.social_auth.social_uid',
    'social.pipeline.social_auth.auth_allowed',
    'social.pipeline.social_auth.social_user',
    'social.pipeline.social_auth.associate_user',
    'social.pipeline.social_auth.load_extra_data',
    'social.pipeline.user.user_details',
    'handshakeapp.pipelines.fill_extendeduser'
)

This is handshakeapp/pipelines.py:

from models import ExtendedUser

def fill_extendeduser(strategy, details, user=None, is_new=False, *args, **kwargs):
    if user and is_new:
        user.extendeduser_set.create(user=user.get_username(), countingID=None, profilePic='http://localhost:8000/pic.png')

But it redirects to /accounts/login/ every time I try to login using Social Auth. It works if I remove 'handshakeapp.pipelines.fill_extendeduser' from SOCIAL_AUTH_PIPELINE. What's wrong?

michaeluskov
  • 1,729
  • 7
  • 27
  • 53
  • Can you add the code to your custom pipline? What does it return? – Timmy O'Mahony Oct 13 '14 at 09:30
  • Looking at the pipeline documentation you need to return either None or a HttpResponse – Timmy O'Mahony Oct 13 '14 at 10:29
  • 2
    @TimmyO'Mahony, try debugging that pipeline if that's the cause of the failure. Django auth process will eat the exceptions and redirect to the value of ``LOGIN_URL`` which by default is ``/accounts/login/``. So, add a ``try/except`` block around your code to check if it's raising any error. – omab Oct 22 '14 at 12:53

1 Answers1

1

The problem was in fill_extendeduser function. It raised an exception and, as mentioned by @omab:

Django auth process will eat the exceptions and redirect to the value of LOGIN_URL which by default is /accounts/login/. So, add a try/except block around your code to check if it's raising any error.

michaeluskov
  • 1,729
  • 7
  • 27
  • 53