Socialid.login.getUserData

From Social ID Developers
Revision as of 20:03, 17 September 2019 by Gabriel.prado (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

Description

API to get custom profile information about the user logged into the current login session.

The profile schema can be accessed and updated through Schema APIs using the schema_name "user_data". The user profile can be updated through the updateUserData JS API, profile update API or directly via Objects APIs using the object_id returned by this API.

Usage

 socialid.login.getUserData(handler)

Parameters

handler optional callback function to handle the API response.

API Response

data Javascript object containing data from the user logged in (see description below).
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, not_found if there is no user logged in the current login session, or forbidden if the user data schema is read protected.

Response Data

The data object properties are at least:

created_at object created date time.
updated_at object last updated date time.
object_id object id.
user_id user id.

More properties depends on the configuration for the schema "user_data".

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("Custom profile information: " + JSON.stringify(response.data));
    } else {
       alert("Could not get info from the current logged in user.");
    }
 }
 socialid.login.getUserData(handler);

Example of "data" object:

 data = {
   created_at: "2015-12-16T12:03:12+00:00",
   updated_at: "2015-12-16T12:03:12+00:00",
   object_id: "1231530003cd0bb82e789001",
   user_id: 632
 }

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

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox