OnlineIdAuthenticator class
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 Connect APIs.
Syntax
var onlineIdAuthenticator = new Windows.Security.Authentication.OnlineId.OnlineIdAuthenticator();
Attributes
- ActivatableAttribute(NTDDI_WIN8)
- MarshalingBehaviorAttribute(Agile)
- ThreadingAttribute(Both)
- VersionAttribute(NTDDI_WIN8)
Members
The OnlineIdAuthenticator class has these types of members:
Constructors
The OnlineIdAuthenticator class has these constructors.
| Constructor | Description |
|---|---|
| OnlineIdAuthenticator | Creates an instance of the OnlineIdAuthenticator. |
Methods
The OnlineIdAuthenticator class has these methods. With C#, Visual Basic, and C++, it also inherits methods from the Object class.
| Method | Description |
|---|---|
| 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. |
| AuthenticateUserAsync(OnlineIdServiceTicketRequest) | Starts the async authentication request with one OnlineIdServiceTicketRequest. If a user is signed into a Windows 8 system with a Microsoft account, this user will be used for the authentication request. |
| SignOutUserAsync | Allows users to sign out of your app. |
Properties
The OnlineIdAuthenticator class has these properties.
| Property | Access type | Description |
|---|---|---|
| Read/write | Returns the ID of the application as a GUID. | |
| Read-only | Returns the ID of a user who has been successfully authenticated for your app. | |
| Read-only | Indicates whether a user can sign out of the app, and whether to show the sign out link in the app. |
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(); }); }
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 |
|
Namespace |
|
|
Metadata |
|
Build date: 3/14/2013
