On upgrading python-social-auth from 0.1.17 to 0.2

2019-03-05 08:21发布

My social-auth pipeline is as follows:

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.user.get_username',
'social.pipeline.social_auth.associate_by_email',
'social.pipeline.user.create_user',
'social.pipeline.social_auth.associate_user',
'social.pipeline.social_auth.load_extra_data',
'social.pipeline.user.user_details',
'useraccounts.models.create_user_profile'
)

When 'useraccounts.models.create_user_profile' does following:

request = kwargs.get('request')
do_something(session_key=request.session.session_key)

Following error comes:

'QueryDict' object has no attribute 'session'

'Request' dictionary has elements with following keys: state, code, prompt, session_state, authuser

I am using Django version 1.5.5. The problem is coming since I have upgraded python-social-auth from v0.1.17 to v0.2.4

2条回答
Lonely孤独者°
2楼-- · 2019-03-05 08:38

This may be because user_details function doesn't pass anything to next function in pipeline. As per your requirement you might need to change the order of functions in your pipeline:

Check this: https://github.com/omab/python-social-auth/blob/master/social/pipeline/user.py#L75

查看更多
神经病院院长
3楼-- · 2019-03-05 08:55

https://github.com/omab/python-social-auth/issues/978

Try to use

strategy.request

to access django request.

查看更多
登录 后发表回答