|
|
Recent pages |
Page last modified 14:25, 17 Mar 2010 by shirly
Gigya's Developer Documentation > API Reference > Client API (JavaScript & AS3) > Methods > socialize.notifyLogin
socialize.notifyLoginFrom $1Table of contents
DescriptionThis API method notifies the Gigya Socialize service that the user has been authenticated by the site. We recommend calling this method when a user logs in to your site using your own login system (the site's username and password). The notifyLogin call registers a new user in Gigya Socialize, in case the siteUID parameter provided is new, or reconnects a returning user in case the siteUID already exists in our records. It is essential to call notifyLogin if you are enabling users in your site to connect to social networks via Gigya (using socialize.showConnectUI or socialize.connect). The notifyLogin call allows Gigya to associate the current user's social connections with the User ID you have designated to this user. This association has several benefits:
Please read more about integrating GS authentication and the implementation flow in our Authentication developer's guide.
Security RequirementsGigya Socialize supports a mechanism to verify the authenticity of the notifyLogin call. This mechanism is used to prove that the call is in fact coming from your site, in order to prevent fraud. We require every notifyLogin call to be signed using a HMAC-SHA1 signature. The "signature" parameter (see table of parameters below) is defined for this objective, and is a required parameter. Gigya will verify the authenticity of the signature parameter to prove that it is in fact coming from your site and not from somewhere else. Follow the instructions in Constructing a Signature to set the signature parameter of the notifyLogin call, and make the API call as soon as possible after that to prevent the signature from expiring.
Syntax
Method parametersconf objectPlease refer to the Conf object page for full specifications. params object members
Response object Data Members
Code Samplevar conf = {
APIKey:'2_fA4cZD0cEmxKUjDdNai8hyK4fZ-Jq7w4qm1x-pkS-7E6NDm90gAmrdcugVoaewUS'
};
var secret = 'Put your secret key here'; // Obtain your secret key from the 'Site Setup' page on Gigya's website
var yourSiteUid= 'sdfsdfsd'; // siteUID should be retrieved from your user management system
function your_b64_hmac_sha1(secret, datePlusSite) {
var b64Sig = ''; // Place your implementation here ...
return b64Sig;
}
function printResponse(response) {
if ( response.errorCode == 0 ) {
alert('After notifyLogin');
}
}
var dateStr = getCurrentTime(); // Current time in Unix format (i.e. the number of seconds since Jan. 1st 1970)
var datePlusSite = dateStr + "_" + yourSiteUid;
var yourSig = your_b64_hmac_sha1(secret, datePlusSite);
var params={
siteUID:yourSiteUid,
timestamp:dateStr,
signature:yourSig,
callback:printResponse
};
gigya.services.socialize.notifyLogin(conf,params);
function your_b64_hmac_sha1(secret:String, datePlusSite:String):String {
var b64Sig:String = ''; // Place your implementation here ...
return b64Sig;
}
function printResponse(response:Object):void {
if (response.errorCode == 0) {
trace('After notifyLogin');
}
}
function notifyLogin():void {
var conf:Object = {
mcRoot:this.root,
APIKey:'2_fA4cZD0cEmxKUjDdNai8hyK4fZ-Jq7w4qm1x-pkS-7E6NDm90gAmrdcugVoaewUS'
};
var secret:String = 'Put your secret key here'; // Obtain your secret key from the 'Site Setup' page on Gigya's website
var yourSiteUid:String= 'sdfsdfsd'; // siteUID should be retrieved from your user management system
var dateStr:String = getCurrentTime(); // Current time in Unix format (i.e. the number of seconds since Jan. 1st 1970)
var datePlusSite:String = dateStr + "_" + yourSiteUid;
var yourSig:String = your_b64_hmac_sha1(secret, datePlusSite);
var params:Object={
siteUID:yourSiteUid,
timestamp:dateStr,
signature:yourSig,
callback:printResponse
};
gigya.services.socialize.notifyLogin(conf,params);
}
Notes:
Retrieved from "http://wiki.gigya.com/030_API_reference/010_Client_API/020_Methods/socialize.notifyLogin"
Tags:
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
Viewing Details: