I am trying to implement a Twitter sign in using Django Social Auth. I have added a partial pipeline where I gather extra details from the user using a form (DOB, email, etc).
My problem is that I want to skip this pipeline if the user already exists. However, when I try to do this I get an AuthTokenError "Token error: Missing unauthorized token" and I cannot figure out why.
Here is code that is causing a problem:
def gather_extra_data(backend, details, uid, request, user=None, *args, **kwargs):
social_user = UserSocialAuth.get_social_auth(backend.name, uid)
if social_user:
return redirect('socialauth_complete', backend.name)
if not details.get('email'):
if not request.session.get('saved_email'):
return redirect(request_extra, backend=backend.name)
else:
details['email'] = request.session['saved_email']
details['password'] = request.session['password']
details['first_name'] = request.session['first_name']
details['last_name'] = request.session['last_name']
details['dob'] = request.session['dob']
details['gender'] = request.session['gender']
details['avatar_url'] = request.session['avatar_url']
SOCIAL_AUTH_PIPELINE
setting. – omab