Gigya Job Openings

accounts.getAccountInfo JS

Skip to end of metadata
Go to start of metadata

 

This method retrieves user account data.

Please note that we recommend using this method from your server-side rather than from your web-client, and only pass the relevant data to the client-side, thus not exposing the entire account data to the client.

 

This method is part of the Customer Identity and the Profile Management - IDS packages. Both packages are premium platforms that require separate activation. If neither are part of your site package, please contact your Gigya Customer Engagement Executive or contact us by filling in a support form on our site. You can also access the support page by clicking "Support" on the upper menu of Gigya's site.

 

Note: This method is also supported in our REST API. If you wish to execute this method from your server, please refer to

 REST API > accounts.getAccountInfo.

Syntax

 

Parameters

The following table lists the available parameters:

RequiredNameTypeDescription
includestring A comma-separated list of fields to include in the response. The possible values are:  identities-active, identities-all, identities-global, loginIDsemails profile, data, regSource, irank, isLockedOut, lastLoginLocation, rba, subscriptions, userInfo, preferences, groups. The default value is "profile, data", so if this parameter is not used, the response will only return the Profile and data objects.
extraProfileFieldsstring This parameter accepts a comma-separated list of additional social profile fields to retrieve. The current valid values are:  languages, address, phones, education, educationLevel, honors, publications, patents, certifications, likes, professionalHeadline, bio, industry, specialities, work, skills, religion, politicalView, interestedIn, relationshipStatus, hometown, favorites, followersCount, followingCount, username, name, locale, verified, timezone, samlData .
callbackfunction
A reference to a callback function. Gigya calls the specified function along with the results of the API method when the API method completes.
The callback function should be defined with the following signature: functionName(Response).
The "Response Object Data Members" table below provides specification of the data that is passed to the callback function.
cidstring
A string of maximum 100 characters length. The CID sets categories for transactions that can be used later for filtering reports generated by Gigya in the "Context ID" combo box. The CID allows you to associate the report information with your own internal data. For example, to identify a specific widget or page on your site/application. You should not define more than 100 different context IDs.

Note: This parameter overrides the value of the identical parameter in Global Conf (the global configuration object). If the parameter is not set for the method, the value from Global Conf is used.

contextobject
A developer-created object that is passed back unchanged to the application as one of the fields in the response object.

Response Object Data Members

FieldTypeDescription
errorCode integer The result code of the operation. Code '0' indicates success, any other number indicates failure. For a complete list of error codes, see the Response Codes and Errors table.
errorMessage string A short textual description of an error associated with the errorCode for logging purposes.
callId string Unique identifier of the transaction, for debugging purposes.
context object The context object passed by the application as a parameter to the API method, or null if no context object has been passed.
   
UID string The unique user ID. This user ID should be used for login verification. See User.UID for more information.
UIDSignature string The signature that should be used for login verification. See User.UID for more information.
signatureTimestamp string The GMT time of the response in UNIX time format, i.e., the number of seconds since Jan. 1st 1970. The timestamp should be used for login verification. See User.UID for more information.
created string The UTC time the account was created in ISO 8601 format, e.g., "1997-07-16T19:20:30Z".
createdTimestamp integer The UTC time the account was created in Unix time format including milliseconds (i.e., the number of seconds since Jan. 1st 1970 * 1000).
data JSON object Custom data. Any data that you want to store regarding the user that isn't part of the Profile object.
emails JSON object The email addresses belonging to the user. This includes the following fields:
  • verified - an array of strings representing the user's verified email addresses
  • unverified - an array of strings representing the user's unverified email addresses.

Note: emails must be specified explicitly in the include parameter in order to be included in the response.

groups JSON object When using CIAM for B2B, this is where the user's Organization Management data is stored. For a detailed description of this field, see the Groups object documentation.
identities array An array of Identity Objects, each object represents a user's social identity. Each Identity Object contains imported data from a social network that the user has connected to.
Note: You must explicitly specify identities within the include parameter for them to be included in the response: identities-active , identities-all, or identities-global to return only active identities, all identities of a site, or all identities of a site group, respectively.
   

Be advised that if a user registers to your site using a Social Identity, then goes through the Forgot Password flow, a Site Login is added to their account, however, a Site Identity is not. A Site Identity can only be created when accounts.setAccountInfo is called on the user's account.

iRank integer Influencer rank of the user. This property is deprecated and will always return 0.
isActive Boolean Indicates whether the account is active. The account is active once the user creates it even without finalizing it. The account can be deactivated, but it will still be registered if the registration process has been finalized. If isActive==false the user cannot log in, however any currently active sessions remain valid.
isLockedOut Boolean Indicates whether the account is currently locked out. This parameter is not included in the response by default, and is not returned at all from accounts.search. If you wish to include it in a response, specify it as a value of the include parameter.
isRegistered Boolean Indicates whether the user is registered. The user is registered once his registration has been finalized.
isVerified Boolean Indicates whether the account email is verified.
lastLogin string The time of the last login of the user in ISO 8601 format, e.g., "1997-07-16T19:20:30Z".
lastLoginLocation JSON object The user's last login location. This includes the following fields:
  • country - a string representing the two-character country code.
  • state - a string representing the state, where available.
  • city - a string representing the city name.
  • coordinates - an object containing:
    • lat - a double representing the latitude of the center of the city.
    • lon - a double representing the longitude of the center of the city.
lastLoginTimestamp integer The UTC time of the last login of the user in Unix time format including milliseconds (i.e., the number of seconds since Jan. 1st 1970 * 1000).
lastUpdated string The UTC time when user profile, preferences, or subscriptions data was last updated (either full or partial update) in ISO 8601 format, e.g., "2017-07-16T19:20:30Z".
lastUpdatedTimestamp integer The UTC time when the last update of the object occurred (either full or partial update) in Unix time including milliseconds, based on when the 'lastUpdated', 'Report AccountsFirstLogin' or 'AccountsReturnedLogin' events are fired.
loginIDs JSON object The user's login identifiers. This includes the following fields:
  • username - a string representing the username
  • emails - an array of strings representing email addresses
  • unverifiedEmails - an array of strings representing email addresses that were not validated

Note: loginIDs must be specified explicitly in the include parameter in order to be included in the response.

loginProvider string The name of the provider that the user used in order to login.
oldestDataUpdated string The UTC time when the oldest data of the object was refreshed in ISO 8601 format, e.g., "1997-07-16T19:20:30Z".
oldestDataUpdatedTimestamp integer The UTC time when the oldest data of the object was refreshed in Unix time format including milliseconds (i.e., the number of seconds since Jan. 1st 1970 * 1000).
password JSON object The user's Site account password details. Includes the following:
  • hash - the hashed password
  • hashSettings - object includes:
    • algorithm - Represents the hash algorithm used to encrypt the password.
    • rounds - Represents the number of iterations to perform the hashing.
    • salt - Represents the BASE64 encoded value of the salt.
    • format - Represents the template for merging clear-text passwords. This is only returned if the pwHashFormat parameter was set during account import and until the user's first login to Gigya (when the user's password is rehashed per the site's settings). See the RaaS Import Guide for additional information.
UIDSignature string This property is deprecated in server to server REST calls! The signature that should be used for login verification. See User.UID for more information.
signatureTimestamp string This property is deprecated in server to server REST calls! The GMT time of the response in UNIX time format, i.e., the number of seconds since Jan. 1st 1970. The timestamp should be used for login verification. See User.UID for more information.
phoneNumber string The Phone Number ID, if the account uses Phone Number Login.Note that this field cannot be mapped using the UI Builder or the Web SDK.
preferences Preferences object The user's preferences information as described in the Preferences Object. To have this data returned in the response it must be specifically requested using the include parameter.
profile Profile object The user's profile information as described in the object. The profile is returned in the response by default, but if the include parameter is used to specify other fields that should be provided in the response, the profile must also be specified explicitly in the include parameter.
rbaPolicy JSON object The current RBA Policy defined for the specified user. Properties include:
  • riskPolicy - Determines the rule set from the defined rulesSets configured in accounts.rba.setPolicy or one of the default policies.
  • riskPolicyLocked - Determines whether the user can change their own riskPolicy. If true, only an admin can change the user's riskPolicy.
registered string The UTC time when the isRegistered parameter was set to true in ISO 8601 format, e.g., "1997-07-16T19:20:30Z".
registeredTimestamp string The GMT time when the isRegistered parameter was set to true in UNIX time format, including milliseconds.
regSource string A string representing the source of the registration. Can be used to set varying destination pages in accounts.setPolicies.
socialProviders string A comma-separated list of the names of the providers to which the user is connected/logged in.
subscriptions Subscriptions Object The user's subscription information.
userInfo User object The Gigya User object. This property is deprecated and should not be relied upon.
verified string The UTC time when the isVerified parameter was set to true in ISO 8601 format, e.g., "1997-07-16T19:20:30Z".
verifiedTimestamp string The GMT time when the isVerified parameter was set to true in Unix time format including milliseconds (i.e., the number of seconds since Jan. 1st 1970 * 1000).

Sample Request

function getAccountInfoResponse(response)
{
    if ( response.errorCode == 0 ) {            
        var profile = response['profile'];
        var msg = profile['firstName'] + ' is ' + profile['age'] + ' years old';
        alert(msg);
    }
    else {
        alert('Error :' + response.errorMessage);
    }    
}

gigya.accounts.getAccountInfo({ callback: getAccountInfoResponse });

Notes:

  • This sample is not meant to be fully functional code. For brevity's sake, only the code required for demonstrating the API call itself is presented.
  • To run the code on your own domain, add your Gigya API key to the gigya.js URL. A Gigya API key can be obtained on the Site Dashboard page on Gigya's website. Please make sure that the domain from which you are loading the page is the same domain name that you used for generating the API key.

 

Response Example

{
  "UID": "_guid_********t3dFD3********zDjcOB********9M-yo********=",
  "UIDSignature": "pOXnjxg********woOob4ZBao8=",
  "signatureTimestamp": "1484148023",
  "loginProvider": "facebook",
  "isRegistered": true,
  "isActive": true,
  "isVerified": true,
  "iRank": 50.0000,
  "loginIDs": {
    "emails": [
      "********@gigya.com"
    ],
    "unverifiedEmails": []
  },
  "emails": {
    "verified": [
      "********@gigya.com"
    ],
    "unverified": []
  },
  "socialProviders": "facebook",
  "profile": {
    "locale": "en_US",
    "timezone": "2",
    "verified": "true",
    "firstName": "********",
    "lastName": "Gigya",
    "photoURL": "https://graph.facebook.com/v2.5/********/picture?type=large",
    "thumbnailURL": "https://graph.facebook.com/v2.5/********/picture?type=square",
    "profileURL": "https://www.facebook.com/app_scoped_user_id/********/",
    "gender": "m",
    "email": "********@gigya.com"
  },
  "identities": [
    {
      "provider": "facebook",
      "providerUID": "********",
      "isLoginIdentity": true,
      "photoURL": "https://graph.facebook.com/v2.5/********/picture?type=large",
      "thumbnailURL": "https://graph.facebook.com/v2.5/********/picture?type=square",
      "firstName": "Levi",
      "lastName": "Gigya",
      "gender": "m",
      "email": "********@gigya.com",
      "profileURL": "https://www.facebook.com/app_scoped_user_id/********/",
      "proxiedEmail": "",
      "allowsLogin": true,
      "isExpiredSession": false,
      "locale": "en_US",
      "timezone": "2",
      "verified": "true",
      "lastUpdated": "2017-01-11T15:14:40.691Z",
      "lastUpdatedTimestamp": 1484147680691,
      "oldestDataUpdated": "2017-01-11T15:14:40.550Z",
      "oldestDataUpdatedTimestamp": 1484147680550
    }
  ],
  "data": {},
  "created": "2017-01-03T16:56:39.331Z",
  "createdTimestamp": 1483462599331,
  "lastLogin": "2017-01-11T15:14:40.581Z",
  "lastLoginTimestamp": 1484147680581,
  "lastUpdated": "2017-01-11T15:14:40.691Z",
  "lastUpdatedTimestamp": 1484147680691,
  "oldestDataUpdated": "2017-01-11T15:14:40.550Z",
  "oldestDataUpdatedTimestamp": 1484147680550,
  "registered": "2017-01-03T16:56:39.534Z",
  "registeredTimestamp": 1483462599534,
  "verified": "2017-01-03T16:56:39.347Z",
  "verifiedTimestamp": 1483462599347,
  "regSource": "http://demo.gigya.com/",
  "lastLoginLocation": {
    "country": "IL",
    "coordinates": {
      "lat": 31.5,
      "lon": 34.75
    }
  },
  "rbaPolicy": {
    "riskPolicyLocked": false
  },
  "statusCode": 200,
  "errorCode": 0,
  "statusReason": "OK",
  "callId": "04da0de89fa34bcbb58f74c64dda6943",
  "time": "2017-01-11T15:20:23.657Z",
  "context": "R721092773"
}

 

Additional Information

For additional information regarding Accounts level data objects, see Accounts Objects REST.