Socialid.login.getUserInfo

(Difference between revisions)
Jump to: navigation, search
(API Response)
(API Response)
Line 19: Line 19:
 
{|
 
{|
 
! align="left" width="200px" | data
 
! align="left" width="200px" | data
| Javascript object containing data from the user logged in. The object properties are: name, email, location, facebook, twitter, linkedin and gplus. The properties facebook, twitter, linkedin and gplus will be available only for the providers connected by the user.
+
| Javascript object containing data from the user logged in. The object properties are: <span style="color: green">user_id*</span>, name, email, location, <span style="color: green">picture_url*</span>, facebook, twitter, linkedin and gplus. The properties facebook, twitter, linkedin and gplus will be available only for the providers connected by the user. <span style="color: green">(*) not available in production yet</span>
 
|+
 
|+
 
! align="left" width="200px" | status
 
! align="left" width="200px" | status

Revision as of 18:41, 13 November 2015

Contents

Description

API to get basic information about the user logged in the current login session.

Usage

 socialid.login.getUserInfo(handler)

Parameters

handler optional Callback function to handle the API response.

API Response

data Javascript object containing data from the user logged in. The object properties are: user_id*, name, email, location, picture_url*, facebook, twitter, linkedin and gplus. The properties facebook, twitter, linkedin and gplus will be available only for the providers connected by the user. (*) not available in production yet
status The API response status. Can be success, if there is an user logged in the current login session and its data was successfully retrieved, or not_found, if there is no user logged in the current login session.

Example

Get basic information about the user logged in the current login session:

 socialid.login.init(1);
 var handler = function(response) {
    if (response.status == "success") {
       alert("Welcome " + data.name);
    } else {
       alert("Could not get info from the current logged in user.");
    }
 }
 socialid.login.getUserInfo(handler);

Example of "data" object:

 data = {
   name: "John Doe",
   email: "johndoe@example.com",
   location: "New York",
   facebook: {
      picture_url: "http://www.facebook.com/johndoe.jpg",
      profile_url: "http://www.facebook.com/johndoe"
   },
   twitter: {
      picture_url: "http://www.twitter.com/johndoe.jpg",
      profile_url: "http://www.twitter.com/johndoe"
   },
   linkedin: {
      picture_url: "http://www.linkedin.com/johndoe.jpg",
      profile_url: "http://www.linkedin.com/johndoe"
   },
   gplus: {
      picture_url: "http://plus.google.com/johndoe.jpg",
      profile_url: "http://plus.google.com/johndoe"
   }
 }

You can test this parameters in our playground: https://sid-examples.herokuapp.com/social_logins/playground

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox