The Gigya service generates several global application events for various situations that are driven by user interactions. This method allows setting event handlers for each of the supported global events.

Description

The Gigya service generates several global application events for various situations that are driven by user interactions.
Global application events are fired whenever the event to which they refer occurs, regardless of which application component triggered the event.
This method allows setting event handlers for each of the supported global events.
To learn more about how to handle events generated by Gigya, see Events.

The following are two of the most used available global application events:

For a complete list of available events, visit the events guide.

An Event Handler is a JavaScript function with the following signature:

functionName(eventObj)

The single argument eventObj, contains information about the event and has different data fields for different events. In "Event Handlers - Event Data" below, you will find the specification of the available fields in the eventObj for each event.

 

RequiredNameTypeDescription
onLoginfunctionA reference to a function that is called when the user is successfully authenticated by Gigya.
onLogoutfunctionA reference to a function that is called when the user has logged out.
callbackfunction
cidstring
contextobject
<script>
var addEventHandlersCodeExampleParams = {
	"api":"accounts.addEventHandlers",
	"langs":"js",
	"containerId":"addEventHandlersCodeExampleContainer",
	"params": {
		"onLogin":function() {
			gigya.accounts.getAccountInfo({
				"callback":function(e) {
					console.log(e);
				}
			});
		},
		"onLogout":function (e) { alert(e); } 
	}
}
</script>
<div id="addEventHandlersCodeExampleContainer"></div>

 

FieldTypeDescription

Event Handlers - Event Data

The following tables specify the list of available data fields in the eventObj for each event.

onLogin Event Data

FieldTypeDescription
eventNamestringThe name of the event: 'login'.
sourcestringThe source plugin that generated this event. The value of this field is the name of the plugin's API method, e.g. 'showLoginUI'.
This field will not be available if the source of this event is not a plugin (e.g. if the source is a socialize.login API call).
contextobjectThe context object passed as a parameter to the plugin/method that triggered this event, or null if no object was passed.
UIDstringThe User ID that should be used for login verification*.
UIDSignaturestringThe signature that should be used for login verification, as described under the Validate the UID Signature in the Social Sign-On Process section.
signatureTimestampstringThe GMT time of the response in UNIX time format (i.e. The number of seconds since Jan. 1st 1970). The time stamp should be used for login verification, as described under the Validate the UID Signature in the Social Sign-On Process section.
loginModestringThe type of login:
  • standard - the userislogging into an existing account.
  • reAuth -  the user is proving ownership of an account by logging into it.
newUserboolean

Whether the current login is for a newly created or existing user (in the database).

When using TFA, a new user is created in the database prior to the user completing TFA and then logging in. This means that newUser is always false when TFA is enabled, even for users whose initial creation triggered the TFA.

providerstringThe name of the provider that the user used in order to login (e.g. "Facebook"). Note: If this event is fired as a result of a socialize.notifyLogin call, i.e. the user was authenticated by your site, the provider field will be set to "site".
profileProfile objectThe user's profile information as described in the Profile object.
dataJSON objectCustom data. Any data that the you want to store regarding the user, which isn't part of the Profile object.
rememberBooleanWhether the user asked to remember his credentials (using a "Remember me" checkbox).

* To learn more about login verification, please refer to the Validate the UID Signature in the Social Sign-On Process section in the Security page of the Developer's Guide.

onLogout Event Data

FieldTypeDescription
eventNamestringThe name of the event: 'logout'.
contextobjectThe context object passed as a parameter to the plugin/method that triggered this event, or null if no object was passed.

 

 

<script>
$(document).ready(function() {
    lssdk.tableFixer();
	lssdk.ceg.run();
});
</script>