django - Using Python Social-auth how to retrieve fields stored in session from custom pipeline -
my app uses python social-auth login allowing accounts "connect". in mind have custom pipeline 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', 'jdconnections.utils.get_username', #<<here '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' )   i have set:
social_auth_fields_stored_in_session = ['connection',]    in app view call social-auth follows e.g twitter:
  return httpresponseredirect(reverse('social:begin', args=('twitter',)) + "?connection=" + request.post.get('origin') )   this works fine , head out twitter , auth completed, when custom pipeline util cannot retrieve session value, doing:
from django.conf import settings django.contrib.sessions.backends.db import sessionstore jdconnections.models import connections  social.pipeline.user import get_username social_get_username  def get_username(strategy, details, user=none, *args, **kwargs):     current_session = sessionstore()    if 'connection' not in current_session:       result = social_get_username(strategy, details, user=user, *args, **kwargs)          return result    else:     if current_session['connection'] == 'tw':         social = user.social_auth.get(provider='twitter')         access_token = social.extra_data['access_token']         cn = connections.objects.create(origin='tw',ctoken = access_token)     return none   using pdb , django debug toolbar can see value there, what's wrong code not retrieve it? help!
according docs, proper way retrieve data is:
strategy.session_get('connection')   perhaps helps?
Comments
Post a Comment