In my website i only need google sign in only., so i am planning to use pipeline like follow.
`SOCIAL_AUTH_PIPELINE = (
'social_core.pipeline.social_auth.social_details',
'social_core.pipeline.social_auth.social_uid',
'social_core.pipeline.social_auth.auth_allowed',
'app.social_auth_pipeline.get_username',
'social_core.pipeline.user.create_user',
)`
In the above pipeline i skip the social_association entirely since like associate_user since i am allowing google login only., but raises Nonetype in do_complete method so what i did was mocked the social auth model and added in pipeline like follow
SOCIAL_AUTH_PIPELINE + ('app.social_auth_pipeline.mock_social_auth_model')
and my pipeline function like below.
def mock_social_auth_model(strategy, details, backend, user=None, *args, **kwargs):
from social_django.models import UserSocialAuth
social = UserSocialAuth()
social.user = user
social.uid = kwargs["uid"]
social.provider = backend.name`
return {
"social": social,
"user": social.user,
"new_association": True
}
Is this approach is safe ?
In my website i only need google sign in only., so i am planning to use pipeline like follow.
)`
In the above pipeline i skip the social_association entirely since like
associate_usersince i am allowing google login only., but raisesNonetypeindo_completemethod so what i did was mocked the social auth model and added in pipeline like followSOCIAL_AUTH_PIPELINE + ('app.social_auth_pipeline.mock_social_auth_model')and my pipeline function like below.
Is this approach is safe ?