WL.logout

Signs the user out of any service using Microsoft account, and clears any user state that is maintained by the JavaScript library, such as cookies.

If the user account is connected to a Windows Store app using JavaScript or web app, this function logs out the user from the app, but not from the PC. This function is useful primarily for web sites that do not use the sign-in control.

Parameters

  • callback

    Optional. Specifies a callback function that is executed when sign-out is complete. The callback function takes the status object as a parameter. For a description of the status object, see WL.getLoginStatus. If you do not specify a callback function, your app can still get the sign-out callback info by listening for an auth.sessionChange or auth.statusChange event.

    Note

    Although the callback parameter is still supported, we recommend that you use the Promise object instead, which is described later in this topic.

Return value

Returns a Promiseobject. This object's then method provides the onSuccess, onError, and onProgress parameters to enable your code to handle a successful, failed, and in-progress call to the corresponding WL.logout method, respectively.

Example

function signUserOut() {
    WL.logout();
}
document.write("<button onclick='signUserOut()'>Click here to sign out!</button>");

Requirements

Library

Wl.js