Hi!

Actually, getUserInfo() is invoked twice in returnFromFb(). Once to get the $fb_profile, then to get the mail field.

if (!$fb_profile = $this->facebookManager->getUserInfo()) {
if (!$email = $this->facebookManager->getUserInfo()->getEmail()) {

The second time could just be:

if (!$email = $fb_profile->getEmail()) {

Sorry, above comment is an aside. The feature request follows:

This variable $fb_profile contains a lot of information that can be usefull to pass to events, so they can be used to populate user entity field. ie. the first/last names, etc.

So, may we pass $fb_profile to authenticateUser() and then pass this and the info returned by getExtraDetails() to events?

Mmm... better yet. $fb_profile could be stored in the {social_auth} table (new column profile_data), so that we could load it at any time to populate user entity fields.

Thank you!

CommentFileSizeAuthor
#3 2947649-3.patch1.8 KBgvso

Comments

markus_petrux created an issue. See original summary.

markus_petrux’s picture

Issue summary: View changes
gvso’s picture

Status: Active » Needs review
StatusFileSize
new1.8 KB

I attach a patch that fixes the first issue.

With respect to storing the data returned in $profile, I would argue that you can actually just add the fields and endpoints you're interested in in the settings form. Many websites don't really need the information in $profile, so maybe it's not a good idea to store it by default. You can always get the data you want though.

Any thoughts?

markus_petrux’s picture

you can actually just add the fields and endpoints you're interested in in the settings form

Doesn't that mean additional calls to the remote service? (impacts performance and quota limits).

gvso’s picture

Project: Social Auth » Social Auth Facebook

Doesn't that mean additional calls to the remote service? (impacts performance and quota limits).

If you're gonna request the same basic user information, yes. However, if you want extra info about the user, I guess you're gonna make an extra request to the API since only email and public_profile is by default requested by Social Auth Facebook after authentication.

gvso’s picture

Status: Needs review » Active
Related issues: +#2951007: Call getUserInfo() only once

I created a new issue where the first problem was solved #2951007: Call getUserInfo() only once

gvso’s picture

Status: Active » Closed (works as designed)

getUserInfo() stores the user information in the $user property. If the method is call inside a module which is using the events, the data will be requested only once.

So, I think it's better to leave the task of saving the user information to an external module.