Search code examples
djangofacebookpython-social-auth

Python-social-auth: disable autoregistering new users


I'm experiencing problems with setting PSA not to register a new user on a login. The documentation says:

It’s possible to override it by defining the setting SOCIAL_AUTH_PIPELINE, for example a pipeline that won’t create users, just accept already registered ones would look like this:

SOCIAL_AUTH_PIPELINE = (
    'social.pipeline.social_auth.social_user',
    'social.pipeline.social_auth.associate_user',
    'social.pipeline.social_auth.load_extra_data',
    'social.pipeline.user.user_details'
)

I add this code to my settings, try to login via Facebook with an already registered user, and after that I'm redirected to default /accounts/login/#_=_ page.

With the default pipeline settings everything works fine and I'm able to log in.


Solution

  • As omab pointed out, working code is

    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'
     )`