Does not authenticate user django-social-auth?

452 views Asked by At

User clicked to link /login/steam. After that all works propetly (django.contrib.auth user instance and social_auth user instance create fine, custom pipeline works. But after when i try to use request.user in my view after login with steam i have error

'AnonymousUser' object is not iterable

My settings.py file

SOCIAL_AUTH_PIPELINE = (
'social.pipeline.social_auth.social_details',
'social.pipeline.social_auth.social_uid',
'social.pipeline.social_auth.social_user',
# custom pipeline
'markers.pipeline.add_steam_data_marker',
# 
'social.pipeline.user.get_username',
'social.pipeline.user.create_user',
'social.pipeline.social_auth.auth_allowed',
'social.pipeline.social_auth.associate_user',
'social.pipeline.social_auth.load_extra_data',
'social.pipeline.user.user_details', )

My custom pipeline.py in app

def add_steam_data_marker(strategy, details, backend, uid, *args, **kwargs):

if backend.name == 'steam':
    try:
        Model.objects.get(steam_user_id=uid)
        return redirect('/home/')
    except ObjectDoesNotExist:
       Model.objects.create(
            ........,
        )

       return redirect('/model/add/')
1

There are 1 answers

1
user3170400 On

All trouble was in AUTHENTICATION_BACKENDS don`t user social. ..... use social_core - >'social_core.backends.steam.SteamOpenId',