Django-social-auth: successfully connected, how to request users now?

I started using https://github.com/omab/django-social-auth and was able to successfully log in via twitter, google and facebook.

Necessary

Do I need to request a registered user to do more things that I will use for this model?

I do not see examples for this

thank

Refresh

@Omab, I did not understand how this would work, can you help. When I log in with twitter, the callback goes to the next code

@login_required
def done(request):
    """Login complete view, displays user data"""
    ctx = {
        'version': version,
        'last_login': request.session.get('social_auth_last_login_backend')
    }
    logging.warn('context - ' + str(ctx))
    logging.warn('request - ' + str(request))
    return render_to_response('home.html', ctx, RequestContext(request))

Can you tell me how I can access the user instance here?

thank

+5
source share
2 answers

UserSocialAuth, :

user.social_auth.filter(provider="...")

:

  • user - (request.user )
  • provider - (facebook, ..)

UserSocialAuth API:

print user_social_auth.tokens
{...}
+6

K-man, ( - ):

    request.user.social_auth.values_list('provider')

, , : id, uid (, facebook), , extra_data​​strong > ( access_token)

+1

All Articles