I was able to use django-socialauthto associate an account (in this case, an instagram account) with an existing user account. I also created my pipeline to collect additional user information:
def update_social_auth(backend, details, response, social_user, uid, user,
*args, **kwargs):
if getattr(backend, 'name', None) in ('instagram', 'tumblr'):
social_user.extra_data['username'] = details.get('username')
social_user.save()
This works great when the account is connected for the first time. However, if the account has already been linked, the field usernamewill not be present in extra_data.
How can I update a user extra_dataafter an association has already been made? Is there a way to use django-socialauthto do this without disconnecting and reconnecting or using an account (e.g. Instagram) API?
If this helps, this is my pipeline for now:
SOCIAL_AUTH_PIPELINE = (
'social_auth.backends.pipeline.social.social_auth_user',
'social_auth.backends.pipeline.social.associate_user',
'social_auth.backends.pipeline.social.load_extra_data',
'social_auth.backends.pipeline.user.update_user_details',
'apps.utils.social.utils.update_social_auth'
)
NT3RP source
share