Learnt to use partial pipeline from django-social-auth

For last few days, I was working on implementing a feature where the users who log in through the social log in methods in Transifex can choose a username, when logging in for the first time. Logically, I had to add in a step in the transifex social_auth_pipeline to display the user with a form to enter the desired username, before the user is created. django-social-auth provides us with Partial Pipeline where one can halt the pipeline process and ask the user for more data, and then resume. As mentioned in the docs:

It’s possible to cut the pipeline process to return to the user asking for more data and resume the process later, to accomplish this add the entry social_auth.backends.pipeline.misc.save_status_to_session (or a similar implementation) to the pipeline setting before any entry that returns an HttpResponse instance

The example below can be used implement partial pipeline


After the pipeline resumes, by default the pipeline is resumed from the next entry after save_status_to_session but this can be modified by setting the following setting to the import path of the pipeline entry to resume processing

SOCIAL_AUTH_PIPELINE_RESUME_ENTRY = 'social_auth.backends.pipeline.misc.save_status_to_session'

This comes handy when the user inputs an invalid/duplicate data and one need to cut the pipeline process again. After implementing this feature, I submitted the patch to upstream and hope to get it accepted.

REFERENCE: http://django-social-auth.readthedocs.org/en/latest/pipeline.html


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: