This page defines the user info object available in Social Login. For failure handling, read failure info object.


User Info Object


The Javascript function ssmi_social_login_success is called upon successful social login. The user info Javascript object is passed as a parameter with this function.

 

The fields of the user info object are defined as follows:


Name Description Example
success This flag is set when social login is successful true
This flag is automatically set when the function ssmi_social_login_success is called.
ss_user_id ID of the user stored in the ShopSocially database. 96-bit hexadecimal numer. 4bb1fcdc421ac90fd6000025
This ID points to the detailed user profile stored in the ShopSocially database.
first_name User’s first name Gretchen
last_name User’s last name Holmes
email User’s email address gretchen.holmes@heyshopper.com
network_type This is the type of social network used for login e.g. ‘facebook’, 'google' facebook

 

If the network_type above is ‘facebook’, the following additional fields are available as a part of the facebook object.


fb_user_id User’s Facebook Profile ID
gender User’s gender
date_of_birth User’s Date of Birth if available
image_url User's Profile Image URL

 

If the network_type above is 'Google', the following additional fields are available as a part of the Google object.


google_user_id User's Google Profile ID
gender User’s gender
date_of_birth User’s Date of Birth if available
image_url User's Profile Image URL

The user info object for the above user will be visible in the browser as follows.


image

 

Here is an example snippet of code used to access the user info object data:


// personData is an internal object that is being

// constructed from the Social Login user_info object

personData = {

userEmail: user_info.email,

loginType: user_info.network_type,

ssUserID: user_info.ss_user_id,

firstName: user_info.first_name,

lastName: user_info.last_name

};

//If the network_type is 'facebook', some additional

//fields are available.

if (person_data.login_type === 'facebook'){

personData.fbUserID = user_info.facebook.fb_user_id;

personData.dateOfBirth = user_info.facebook.date_of_birth;

personData.userGender = user_info.facebook.gender;

}

//If the network_type is 'google', some additional

//fields are available.

if (person_data.login_type === 'google'){

personData.googleUserID = user_info.google.google_user_id;

personData.dateOfBirth = user_info.google.date_of_birth;

personData.userGender = user_info.google.gender;

}


When the Javascript function ssmi_social_login_success is called, you must take all the fields from the user_info object and process them to complete the user login. You must consider all Social Login Scenarios. Also look at a Social Login Reference Example.  


For failure handling, read failure info object.

Or go back to Social Login page.