OnlineIdAuthenticator Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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.
In a desktop app, before using an instance of this class in a way that displays UI, you'll need to associate the object with its owner's window handle. For more info, and code examples, see Display WinRT UI objects that depend on CoreWindow.
Note
If you're developing for Windows 10 or later, use the Windows.Security.Authentication.Web.Core APIs instead. For more information, see Web account manager.
public ref class OnlineIdAuthenticator sealed
/// [Windows.Foundation.Metadata.Activatable(65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class OnlineIdAuthenticator final
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
class OnlineIdAuthenticator final
[Windows.Foundation.Metadata.Activatable(65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class OnlineIdAuthenticator
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
public sealed class OnlineIdAuthenticator
function OnlineIdAuthenticator()
Public NotInheritable Class OnlineIdAuthenticator
- Inheritance
- Attributes
Windows requirements
Device family |
Windows 10 (introduced in 10.0.10240.0)
|
API contract |
Windows.Foundation.UniversalApiContract (introduced in v1.0)
|
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() |
Creates an instance of the OnlineIdAuthenticator. In a desktop app, before using an instance of this class in a way that displays UI, you'll need to associate the object with its owner's window handle. For more info, and code examples, see Display WinRT UI objects that depend on CoreWindow. Note If you're developing for Windows 10 or later, use the Windows.Security.Authentication.Web.Core APIs instead. For more information, see Web account manager. |
Properties
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 |
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 |
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) |
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) |
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() |
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. |