Sys.Services AuthenticationService defaultLoginCompletedCallback Property
Gets or sets the name of the default login-completed callback function.
Note
To get or set property values for client API properties, you must call property accessor methods that are named with the get_ and set_ prefixes. For example, to get or set a value for a property such as cancel, you call the get_cancel or set_cancel methods.
Sys.Services.AuthenticationService.set_defaultLoginCompletedCallback(value);
var defaultLoginCompletedCallback =
Sys.Services.AuthenticationService.get_defaultLoginCompletedCallback();
Parameters
Parameter |
Description |
---|---|
value |
A string that contains the name of the default login-completed callback function. |
Remarks
The function that you assign to the defaultLoginCompletedCallback property is used as the default callback function for successful authentication. You can override this default callback function by passing the name of a different function to the login method.
When implementing this callback function, you must use the following signature:
function LoginComplete(bool validCredentials, serContext, methodName)
The parameters passed to the callback function have the following meaning:
validCredentials. Returns true if the user was authenticated.
userContext. User context information that you pass to the login method.
methodName. The name of the calling method.
The callback function is called asynchronously if the authentication service finishes successfully.
Note
The fact that the authentication service completed successfully does not mean that the user's credentials were valid. To check whether the credentials were authenticated, you must check whether validCredentials is set to true.
Example
The following example shows how to use defaultLoginCompletedCallback property This code is part of a complete example found in the Sys.Services.AuthenticationService class overview.
// This function sets and gets the default
// login completed callback function.
function SetDefaultLoginCompletedCallBack()
{
// Set the default callback function.
Sys.Services.AuthenticationService.set_defaultLoginCompletedCallback(OnLoginCompleted);
// Get the default callback function.
var callBack =
Sys.Services.AuthenticationService.get_defaultLoginCompletedCallback();
}