You are not logged in.   Log in | Register

socialize.showLoginUI

From $1

Description

Displays a "Login" Widget, which is the Gigya Socializes user authentication Widget. The Widget displays all the available providers' logos as login options, enabling the user to login to your site via his social network / webmail account.

Currently the Widget displays, by default, the logos of the following providers: Facebook, Myspace, Twitter, Yahoo, LinkedIn, AOL, Windows Live ID, Google, WordPress, BloggerID, Typepad, liveJournal, Hyves, VeriSignID.
You may customize this list using the requiredCapabilities parameter or by using the enabledProviders and disabledProviders parameters.

The Widget may be embedded in the page or displayed as a popup at the center of the page. If the Widget is opened as a popup, then it automatically disappears at the end of the login process.

 

Syntax

gigya.services.socialize.showLoginUI(conf,params)

 

Method parameters

conf object

Please refer to the Conf object page for full specifications.

params object members

Required Name Type Description
Optional width integer Determines the width you desire for the Widget.
  height integer Determines the height you desire for the Widget.

containerID string
Supported in JavaScript only (In ActionScript use the container parameter instead).
An ID of a <DIV> element on the page in which you want to display the Widget.
If this parameter is not provided then the Widget will be displayed as a popup at the center of the page.
  container object reference
Supported in ActionScript only (In JavaScript use the containerID parameter instead).
Reference of a container object (e.g. Canvas) in which you want to display the Widget. If this parameter is not provided then the Widget will be displayed as a popup at the center of the application.
  showCaption boolean By default the Widget shows a caption when in dialog mode and does not show one when displayed inside a div (when a containerID was provided). This allows you to override this default behavior.
  captionText string Sets the caption text. This parameter is relevant only if a caption is shown (see the showCaption parameter above).

showTermsLink boolean Show or hide the "Terms" link. Clicking the "Terms" link opens Gigya's Legal Notices page.
  context object A reference to a developer created object that will be passed back unchanged to the event handlers as one of the fields of the eventObj (see extended explanation in the "Widget Events" section below).
  UIConfig string (XML) An XML string describing changes to the default design of the Widget.
  useFacebookConnect boolean Assigning "true" to this parameter, will cause Gigya Socialize to pop-up Facebook Connect UI when connecting to the user's Facebook account (i.e. when the user presses the Facebook button of the Connect UI). You may find more information about the subject in Using Facebook Connect section in the Developer Guide.
Note: this parameter is not supported in ActionScript environment.

enabledProviders string A comma delimited list of providers that should be displayed on this widget. Valid provider names include: facebook, myspace, twitter, yahoo, linkedin, google, aol, liveid, wordpress, bloggerid, typepad, livejournal, hyves, verisignid.
For example, if you would like this widget to show only the icons of Facebook and Twitter, define: enabledProviders="facebook,twitter".
Note: the value of this parameter overrides the value of the identical parameter in the Conf object.
  disabledProviders string A comma delimited list of provider that should not be displayed on this widget. Valid provider names include: facebook, myspace, twitter, yahoo, linkedin, google, aol, liveid, wordpress, bloggerid, typepad, livejournal, hyves, verisignid.
For example, if you would like this widget to show all providers but LinkedIn and Twitter, define: disabledProviders="linkedin,twitter".
Note: the value of this parameter overrides the value of the identical parameter in the Conf object.
  invite Invite object If this parameter is specified then the "Invite" dialog will be displayed when a user logs-in to Facebook. You may find more information about the subject in Inviting Friends section in the Developer's Guide.
  shortURLs string This parameter is relevant only if you use the 'invite' parameter defined above.
Using this parameter you may determine whether to use Gigya's URL shortening service for URLs, which are published through this method. The optional values for this parameter are:
  • 'always' (default): always shorten URLs.
  • 'whenRequired': shorten URLs when needed - when posting to Twitter, LinkedIn, MySpace and Yahoo where the status update is limited to 140 char.
  • 'never' - never shorten URLs.

When Gigya's URL shortening service is active, Gigya tracks all the traffic coming from the distributed URLs. In such case, 'Referred Traffic' reports will be available to you.
Note: the value of this parameter overrides the value of the identical parameter in the Conf object.

  headerText string Sets the Widget's header text.
  requiredCapabilities string A comma separated list of any of the following capabilities: login, notifications, actions, friends, status, photos. Only providers that are available and support all the required capabilities will be visible.
The default required capability is: 'friends'.
  redirectURL URL A URL to redirect the user to when the login completes successfully.
The following additional parameters will be appended to the URL string:
UID, UIDSig, timestamp, loginProvider, nickname, photoURL, thumbnailURL, firstName, lastName, gender, birthDay, birthMonth, birthYear, email, country, state, city, zip, profileURL, proxiedEmail, provider.
These parameters are equivalent to the User object fields. Please find the parameters' description in the User object reference page.
If the redirectURL parameter is supplied, the onLogin global event will not be called.
Note: the redirectURL parameter is not supported in ActionScript environment.
  sessionExpiration integer This parameter defines the time in seconds that Gigya should keep the login session valid for the user. To end the session when the browser closes, please assign the value '0'. If this parameter is not specified, the session will be valid forever.
  buttonsStyle string This parameter enables selecting one of the pre-defined design styles for the network buttons on the Login UI. Currently Gigya offers two design styles:
  • 'standard' (default):
    ButtonsStyle-Standard.gif
  • 'blue':
    ButtonsStyle-OceanBlue.gif
  SNButtonsURL URL A URL of a resource library SWF file with custom network icons. The purpose of this parameter is for replacing the icons of the network buttons on the Login UI. The Custom Network Icons section (in the Developer Guide) guides how to implement this feature.
  lastLoginIndication string By default, the Login Widget gives an indication of the last provider the user was logged into.
You may change this behavior using this parameter. Currently supported values for this parameter are:
  • "star" (default) - Last login provider's logo will be displayed first and will be ornamented with a star.
  • "none" - There will be no indication for last login provider.
  cid string A string of maximum 100 characters length. This string will be associated with each transaction and will later appear on 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. The "Context ID" combo box lets you filter the report data by site/application context.
Note: the value of this parameter overrides the value of the identical parameter in the Conf object.
  onLoad function ref A reference to an event handler function that will be called when the Widget has finished drawing itself.
  onClose function ref A reference to an event handler function that will be called in one of the following scenarios:
  • If the Widget is displayed as a popup the event will be fired when the Widget is closing.
  • If the Widget is embedded in page the event will be fired when the user clicks a button that indicates the dialog should be closed. In this case the dialog will not hide itself automatically.
  onError function ref A reference to an event handler function that will be called when an error occurs.

 

Widget Events

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 fields for different events.

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

 

onLoad event data

Field Type Description
eventName string The name of the event.
context object The context object passed by the application as parameter to the API method, or null if no context object has been passed.

 

onClose event data

Field Type Description
eventName string The name of the event.
context object The context object passed by the application as parameter to the API method, or null if no context object has been passed.

 

onError event data

Field Type Description
eventName string The name of the event.
context object The context object passed by the application as parameter to the API method, or null if no context object has been passed.
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 Error Codes table.
errorMessage string A short textual description of an error, associated with the errorCode, for logging purposes.

 

Global Event Triggered

By using this Widget, the onLogin global event may be triggered (the onLogin global event is fired, when a user successfully logs in to GS). To register an event handler use the socialize.addEventHandlers API method. Refer to the onLogin event data. Refer to the Events page in the Developer's Guide - to learn more about how to handle events generated by Gigya socialize.

 

Code Sample

var conf = { 
    APIKey:'2_fA4cZD0cEmxKUjDdNai8hyK4fZ-Jq7w4qm1x-pkS-7E6NDm90gAmrdcugVoaewUS'
};

var context = {
    msg:'This is my params.context.msg'
};	

var params = {
    showCaption: true,
    captionText: 'This is my caption text',
    headerText: 'This is my header content',
    showTermsLink: 'false',
    useFacebookConnect: 'true',
    redirectURL: 'http://www.yourNewSite.com',
    context: context,
    SNButtonsResourceURL: 'http://www.test.com/buttons.swf'
};

params['onLoad'] = function(evt) {              
    evt['msg'] = 'After onLoad';
    var msg = 'Event name is : ' + evt.eventName +'\n';
    msg+= 'evt[\'msg\'] is : ' + evt['msg']+'\n';
    msg+= 'context.msg is : ' + evt['context']['msg'];            
    alert(msg);
};

gigya.services.socialize.showLoginUI(conf,params);
function showLoginUI():void {
	var conf:Object = { 
		mcRoot:this.root,
		APIKey:'2_fA4cZD0cEmxKUjDdNai8hyK4fZ-Jq7w4qm1x-pkS-7E6NDm90gAmrdcugVoaewUS'
	};

	var context:Object = {
		msg:'This is my params.context.msg'
	};	

	var params:Object = {
		showCaption: true,
		captionText: 'This is my caption text',
		headerText: 'This is my header content',
		showTermsLink: 'false',
		context: context,
		SNButtonsResourceURL: 'http://www.test.com/buttons.swf'
	};

	params['onLoad'] = function(evt:Object):void {              
		evt['msg'] = 'After onLoad';
		var msg = 'Event name is : ' + evt.eventName +'\n';
		msg+= 'evt[\'msg\'] is : ' + evt['msg']+'\n';         
		trace(msg);
	};

	gigya.services.socialize.showLoginUI(conf,params);
}

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.
  • The API key in the sample will only work on http://localhost/...
  • To run the code on your own domain, modify the API key in the example to your own API key. A Gigya API Key can be obtained on the Site Setup page on Gigya's website. Please make sure that the domain you are loading the page from is the same domain name that you used for generating the API Key.
  • In some cases it is necessary to connect the user to a provider? prior to calling the API method. For connecting the user to a provider, you may use the Connect API method call or the pre-built Connect Widget.
  • Best practice is, to define one global conf object and use it throughout the application.

 

In the Login page you will find a complete working example which uses the socialize.showLoginUI method. You may view the code, run it and view the outcome.

Tags:
Files (0)