David
David

Reputation: 31

Cannot set custom parameter with python social auth

I've followed docs to set my custom parameter, but I still cannot get it from my custom pipeline function.

Here is the setting:

In settings.py:

FIELDS_STORED_IN_SESSION = ['tgtid']

SOCIAL_AUTH_PIPELINE = (
    'mindex.users.auth.pipeline.user_data',
    'social.pipeline.social_auth.auth_allowed',
    'social.pipeline.social_auth.social_user',
    'social.pipeline.user.create_user',
    'social.pipeline.social_auth.associate_user',
    'social.pipeline.user.user_details',
    'mindex.users.auth.pipeline.save_token',
    'mindex.users.auth.pipeline.add_social',
)

Example of redirect url is:

/login/facebook/?tgtid=1&next=/report/1/connect_task/

In my add_social function, I cannot read tgtid, strategy.session_get('tgtid') returns None. The signature of add_social function is:

add_social(strategy, social, response, *args, **kwargs)

Upvotes: 1

Views: 395

Answers (1)

David
David

Reputation: 31

I've figured out myself.

Just add the following line to settings.py:

SOCIAL_AUTH_FIELDS_STORED_IN_SESSION = ('tgtid', )

Upvotes: 2

Related Questions