UserAuthenticationOperation class

Asynchronously gets the user's identity and corresponding tickets and properties.

Syntax


public ref class UserAuthenticationOperation sealed : IAsyncOperation<UserIdentity>,
    IAsyncInfo

Attributes

[MarshalingBehavior(Agile)]
[Version(0x06020000)]

Members

The UserAuthenticationOperation class has these types of members:

Methods

The UserAuthenticationOperation class has these methods. With C#, Visual Basic, and C++, it also inherits methods from the Object class.

MethodDescription
Cancel Requests the cancellation of the operation.
Close Requests that work associated with the operation should terminate.
GetResults Returns a UserIdentity object that contains information about the user.

 

Properties

The UserAuthenticationOperation class has these properties.

PropertyAccess typeDescription

Completed

Read/writeGets or sets a handler that's called when the operation completes.

ErrorCode

Read-onlyGets the error code should the operation fail.

Id

Read-onlyGets a unique identifier that represents the operation.

Status

Read-onlyGets the current status of the operation.

 

Remarks

Windows Phone 8

This API is not implemented and will throw an exception if called. See Windows Phone Runtime API.

Examples

The following example shows how to specify the service and policy that is used to authenticate a Live user.


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();
                });
}

Requirements

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

Minimum supported phone

Windows Phone 8 [not implemented, see Remarks]

Namespace

Windows.Security.Authentication.OnlineId
Windows::Security::Authentication::OnlineId [C++]

Metadata

Windows.winmd

 

 

Show:
© 2014 Microsoft