信息
您所需的主题如下所示。但此主题未包含在此库中。
1(共 1)对本文的评价是有帮助 - 评价此主题

OnlineIdAuthenticator Class

提供应用程序能够启动身份验证的请求获取 JavaScript 对象表示法 (JSON) 标记要使用的服务或请求可用于获取数据的票证用户授予对为您的应用程序使用活动联接 API。

语法


var onlineIdAuthenticator = new Windows.Security.Authentication.OnlineId.OnlineIdAuthenticator();

特性

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

成员

OnlineIdAuthenticator类 具有以下类型的成员:

构造函数

OnlineIdAuthenticator类 具有以下构造函数。

构造函数描述
OnlineIdAuthenticator Creates an instance of the OnlineIdAuthenticator.

 

方法

The OnlineIdAuthenticator 类 具有以下方法。 使用 C#、Visual Basic 和 C++,它还可以继承以下内容中的方法 Object 类.

方法描述
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.

 

属性

OnlineIdAuthenticator类 具有以下属性。

属性访问类型描述

ApplicationId

读取/写入Returns the ID of the application as a GUID.

AuthenticatedSafeCustomerId

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

CanSignOut

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

 

示例

下面的示例演示如何处理用户身份验证请求。


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

要求

最低受支持的客户端

Windows 8 [仅 Windows 应用商店应用]

最低受支持的服务器

Windows Server 2012 [仅 Windows 应用商店应用]

最低受支持的电话

Windows Phone 8

命名空间

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

元数据

Windows.winmd

 

 

本文是否对您有所帮助?
(1500 个剩余字符)
感谢您的反馈
显示:
© 2014 Microsoft. 版权所有。