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 Registration-as-a-Service 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 Account Manager 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, loginIDsemails profile, data, regSource, irank, rba. The default value is " profile, data " so if this parameter is not used, the response will 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, honors, publications, patents, certifications, likes, professionalHeadline, bio, industry, specialties, work, skills, religion, politicalView, interestedIn, relationshipStatus, hometown, favorites, followersCount, followingCount, username, locale, verified, timezone, and 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 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 stringThe 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 time the account was created in ISO 8601 format, e.g., "1997-07-16T19:20:30Z".
createdTimestamp integer The 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.

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. The iRank is a number between 0-99, which denotes the percentile location of the user in comparison to all other site users as a site influencer. For example, if a user's iRank equals 60, this means that 60% of the site users influence less than this user, or in other words, this user is in the top 40% of site influencers.
The iRank is calculated based on the amount of exposure this user provides the site. The calculation is done for the past several months, where recent activities receive higher ranks. The iRank is per site (per API key), the same user may have different ranks for different domains. The iRank calculation uses the following parameters:
  • The number of friends this user has in all the networks to which he is connected through this site.
  • The number of times this user shared something in this site (per month).
  • The number of click backs that were made as a result of this user's shares.
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.
isLockedOut Boolean Indicates whether the account is currently locked out.
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 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 time when the account object was last updated (either full or partial update) in ISO 8601 format, e.g., "1997-07-16T19:20:30Z". This is updated when any change is made to the account, for example, when a password is changed or a user logs in.
lastUpdatedTimestamp integer The time when the last update of the object occurred (either full or partial update) in Unix time, i.e., seconds since Jan. 1st 1970. Based on 'lastUpdated', 'Report AccountsFirstLogin' or 'AccountsReturnedLogin' event 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 time when the oldest data of the object was refreshed in ISO 8601 format, e.g., "1997-07-16T19:20:30Z".
oldestDataUpdatedTimestamp integer The 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.
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.
registered string The 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, i.e., the number of seconds since Jan. 1st 1970.
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.
verified string The 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).

Code Sample

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,
  "isLockedOut": false,
  "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"
}