AuthError Enumeration

AuthError Enumeration

Ff751915.note(en-us,MSDN.10).gifNote:
Current information about Live Connect is now available in the Windows Live Developer Center. The information in the following sections is provided for legacy purposes only.

Describes authentication failures.

Script:  http://js.live.net/4.1/loader.js
Feature:  Microsoft.Live
Namespace:  Microsoft.Live
 
Ff751915.alert_note(en-us,MSDN.10).gifNote

The JavaScript Library for Windows Live Messenger Connect is built by using the Microsoft Ajax Library. Microsoft Ajax exposes a type system that enables you to add object-oriented capabilities to your JavaScript code. To learn more about creating and using enumerations, see Creating Custom Client Script by Using the Microsoft Ajax Library.

// Declaration:
Microsoft.Live.AuthError = function() {};
Microsoft.Live.AuthError.prototype = {
    none     : 0,
    general  : 1,
    canceled : 2,
    timeout  : 3
};
Microsoft.Live.AuthError.registerEnum(
    'Microsoft.Live.AuthError',
    false);

// Usage:
if (Microsoft.Live.AuthError.timeout == value) {

}

An AuthError instance can be obtained from the AuthenticationCompletedEventArgs object. AuthenticationCompletedEventArgs contains the event information for the getConsent method of the Auth class.

The following example demonstrates how to use AuthError to provide additional information to the user when the authentication process fails.

var auth;
function appLoaded() {
    auth = Microsoft.Live.App.get_auth();
    auth.set_requestedScopes([Microsoft.Live.Scope.wl_Profiles_View]);
    auth.getConsent(appAuthenticated);
}
function appAuthenticated(authenticationCompletedEventArgs) {
    var auth = authenticationCompletedEventArgs.get_auth();
    switch (auth.get_state()) {
        case Microsoft.Live.AuthState.authenticated:
            alert("Authentication completed.");
            break;
        case Microsoft.Live.AuthState.failed:
            var authError = authenticationCompletedEventArgs.get_authError();
            alert("Authentication failed, " + Microsoft.Live.AuthError.toString(authError));
            break;
        default:
            var authError = authenticationCompletedEventArgs.get_authError();
            alert("Authentication unsuccessful, " + Microsoft.Live.AuthError.toString(authError));
            break;
    }
}

Windows Live Messenger Connect

Supported in: 4.1

Internet Explorer 8.0, Internet Explorer 7.0, Internet Explorer 6.0, Firefox 3.6, Firefox 3.5, Firefox 3.0, Firefox 2.0, Firefox 1.5, Chrome 4.0, Chrome 3.0, Chrome 2.0, Chrome 1.0, Safari 4.0, Safari 3.0

Show:
© 2016 Microsoft