Question

this is my first project with django and i install django social auth and works fine but when i use custom pipelines the registration goes to /login-error

use python 2.6 django 1.6.2

#settings.py

SOCIAL_AUTH_PIPELINE = (
'social_auth.backends.pipeline.social.social_auth_user',
'social_auth.backends.pipeline.user.create_user',
'social_auth.backends.pipeline.social.associate_user',
'social_auth.backends.pipeline.social.load_extra_data',
'social_auth.backends.pipeline.user.update_user_details',
'social_auth.backends.pipeline.misc.save_status_to_session',
'app.pipelines.get_user_avatar'
)


#pipelines.py

def get_user_avatar(strategy, user, response, is_new=False,*args,**kwargs):
url = None
if is_new and strategy.backend.name == 'facebook':
    url = "http://graph.facebook.com/%s/picture?type=large" % response['id']
if url:
    profile = user.get_profile()
    profile.photo = url # depends on where you saved it
    profile.save()


#models.py

from django.db import models
from django.contrib.auth.models import User

class Profile(models.Model):
    user = models.ForeignKey(User)
    points = models.IntegerField(default = 0)
    photo = models.URLField()
Was it helpful?

Solution

There are several details in your code which aren't correct.

  1. 'social_auth.backends.pipeline.misc.save_status_to_session' should be used only if you plan to redirect the user to another view/form (breaking the processing and continuing it later)
  2. Your custom pipeline is using strategy which is a parameter in python-social-auth but not django-social-auth.

Since you are starting I would suggest to go directly with python-social-auth since django-social-auth is deprecated.

OTHER TIPS

You need to use python social auth instead. Django social auth is deprecated.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top