WL.getLoginStatus

Returns the sign-in status of the current user, in a Windows Store app using JavaScript or web app.

If the user is signed in and connected to your app, this function returns the session object. This is an asynchronous function that returns the user's status by contacting the service using Microsoft account authentication web service.

Parameters

  • callback

    Optional. Specifies the name of a callback function to execute when the user's sign-in status is retrieved. This function takes the status object as a parameter. For more info about the status object, see the "Return values" section that follows.

  • force

    Optional. If set to "true", the function contacts the service using Microsoft account authentication web service to determine the user's status. If set to "false" (the default), the function can return the user status that is currently in memory, if there is one. If the user's status has already been retrieved, the library can return the cached value. However, you can force the library to retrieve current status by setting the force parameter to "true".

Return value

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

In the body of the onSuccess function, a status object is returned, which contains the user's sign-in status and the session object. This object contains the following properties.

Property

Type

Description

status

string

The sign-in status of the user. Valid values are "connected", "notConnected", or "unknown".

session

object

A JSON object that contains the properties of the current session. For a detailed description of the session object's properties, see the "Return Values" section of WL.getSession.

Example

function loginStatus() {
    WL.getLoginStatus(function(response) { alert("Your status is: " + response.status) });
}

Requirements

Library

Wl.js