Devang
Devang

Reputation: 1541

Using get_user_details in django-social-auth

I am trying to use django-social-auth to allow my users to log into the website using Facebook. I want to save the first and last name, and email of the user. However, using the setup in the documentation, it saves the username, email and auth token, but for some reason it does not save the first and last names. Looking at the code, the FacebookBackend class provides the function get_user_details but I am not sure how it can be used. It would seem that there should be a simple way to obtain this information. If not, there is always the option to add an additional pipeline.

Upvotes: 1

Views: 1017

Answers (1)

Hedde van der Heide
Hedde van der Heide

Reputation: 22439

First and lastname are already retrieved by the default pipeline. The facebook backend calls get_user_details (line 47) which sets first and last name.

The default pipeline even updates these details by calling the method again on each succesful login. This behaviour can be turned off by composing your own pipeline excluding:

'social_auth.backends.pipeline.user.update_user_details'

So either your facebook user doesn't have a first and last name set, or your settings might be wrong, which version are you running?

Upvotes: 1

Related Questions