OnlineIdAuthenticator OnlineIdAuthenticator OnlineIdAuthenticator OnlineIdAuthenticator OnlineIdAuthenticator Class

Definition

Provides an app with the ability to start the authentication request to get JavaScript Object Notation (JSON) tokens to use with your service or request tickets that can be used to get data that the user has consented to for your app using the Live ConnectAPI.

Note

If you are developing for Windows 10 or greater, use the Windows.Security.Authentication.Web.Core APIs instead. For more information, see Web account manager.

public : sealed class OnlineIdAuthenticator : IOnlineIdAuthenticator
struct winrt::Windows::Security::Authentication::OnlineId::OnlineIdAuthenticator : IOnlineIdAuthenticator
public sealed class OnlineIdAuthenticator : IOnlineIdAuthenticator
Public NotInheritable Class OnlineIdAuthenticator Implements IOnlineIdAuthenticator
var onlineIdAuthenticator = new onlineIdAuthenticator();
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Examples

The following example shows how to handle a user authentication request.

function signIn() {
    var authenticator = new Windows.Security.Authentication.OnlineId.OnlineIdAuthenticator();
    var serviceTicketRequest = new Windows.Security.Authentication.OnlineId.OnlineIdServiceTicketRequest(
        "wl.basic wl.contacts_photos wl.calendars", "DELEGATION");

    sdkSample.displayStatus("Signing in...");

    authenticator.authenticateUserAsync(serviceTicketRequest)
        .done(function (authResult) {

            if ((authResult.tickets.size == 1) && (authResult.tickets[0].errorCode == 0)) {
                sdkSample.isSignedIn = true;
                sdkSample.displayStatus("Authorization succeeded.");
                sdkSample.accessToken = authResult.tickets[0];
                sdkSample.canSignOut = authenticator.canSignOut;
            }
        },

            function (authStatus) {
                if (authStatus && (authStatus.name !== "Canceled")) {
                    showErrorMessage("Autorization failed: " + authStatus.message);
                } else {
                    sdkSample.displayStatus("");
                }
                    showAccountStatus();
                });
}

Constructors

OnlineIdAuthenticator() OnlineIdAuthenticator() OnlineIdAuthenticator() OnlineIdAuthenticator() OnlineIdAuthenticator()

Creates an instance of the OnlineIdAuthenticator.

Note

If you are developing for Windows 10 or greater, use the Windows.Security.Authentication.Web.Core APIs instead. For more information, see Web account manager.

Properties

ApplicationId ApplicationId ApplicationId ApplicationId ApplicationId

Returns the ID of the application as a GUID.

Note

If you are developing for Windows 10 or greater, use the Windows.Security.Authentication.Web.Core APIs instead. For more information, see Web account manager.

AuthenticatedSafeCustomerId AuthenticatedSafeCustomerId AuthenticatedSafeCustomerId AuthenticatedSafeCustomerId AuthenticatedSafeCustomerId

Returns the ID of a user who has been successfully authenticated for your app.

Note

If you are developing for Windows 10 or greater, use the Windows.Security.Authentication.Web.Core APIs instead. For more information, see Web account manager.

CanSignOut CanSignOut CanSignOut CanSignOut CanSignOut

Indicates whether a user can sign out of the app, and whether to show the sign out link in the app.

Note

If you are developing for Windows 10 or greater, use the Windows.Security.Authentication.Web.Core APIs instead. For more information, see Web account manager.

Methods

AuthenticateUserAsync(IIterable<OnlineIdServiceTicketRequest>, CredentialPromptType) AuthenticateUserAsync(IIterable<OnlineIdServiceTicketRequest>, CredentialPromptType) AuthenticateUserAsync(IIterable<OnlineIdServiceTicketRequest>, CredentialPromptType) AuthenticateUserAsync(IIterable<OnlineIdServiceTicketRequest>, CredentialPromptType) AuthenticateUserAsync(IIterable<OnlineIdServiceTicketRequest>, CredentialPromptType)

Starts the async authentication request with multiple OnlineIdServiceTicketRequests and provides the ability to control the user experience by setting the CredentialPromptType to get the tickets. If a user is signed into a Windows 8 system with a Microsoft account, this user will be used for the authentication request.

Note

If you are developing for Windows 10 or greater, use the Windows.Security.Authentication.Web.Core APIs instead. For more information, see Web account manager.

AuthenticateUserAsync(OnlineIdServiceTicketRequest) AuthenticateUserAsync(OnlineIdServiceTicketRequest) AuthenticateUserAsync(OnlineIdServiceTicketRequest) AuthenticateUserAsync(OnlineIdServiceTicketRequest) AuthenticateUserAsync(OnlineIdServiceTicketRequest)

Starts the asynchronous authentication request with one OnlineIdServiceTicketRequest by showing the credential prompt if needed to collect credentials or consent and get the ticket. If a user is signed into a Windows 8 system with a Microsoft account, this user will be used for the authentication request.

Note

If you are developing for Windows 10 or greater, use the Windows.Security.Authentication.Web.Core APIs instead. For more information, see Web account manager.

SignOutUserAsync() SignOutUserAsync() SignOutUserAsync() SignOutUserAsync() SignOutUserAsync()

Allows users to sign out of your app.

Note

If you are developing for Windows 10 or greater, use the Windows.Security.Authentication.Web.Core APIs instead. For more information, see Web account manager.