此页面有用吗?
您对此内容的反馈非常重要。 请告诉我们您的想法。
更多反馈?
1500 个剩余字符
导出 (0) 打印
全部展开
信息
您所需的主题如下所示。但此主题未包含在此库中。

OnlineIdServiceTicketRequest Class

为应用程序提供指定用于验证 Live 用户身份以获取标识属性和票证的服务和政策的功能。

语法


var onlineIdServiceTicketRequest = new Windows.Security.Authentication.OnlineId.OnlineIdServiceTicketRequest(string, string);
var onlineIdServiceTicketRequest = new Windows.Security.Authentication.OnlineId.OnlineIdServiceTicketRequest(string);

特性

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

成员

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

构造函数

OnlineIdServiceTicketRequest类 具有以下构造函数。

构造函数描述
OnlineIdServiceTicketRequest(String) Creates an instance of the OnlineIdServiceTicketRequest class.
OnlineIdServiceTicketRequest(String, String) Creates an instance of the OnlineIdServiceTicketRequest class.

 

方法

The OnlineIdServiceTicketRequest 类 继承以下内容中的方法 Object 类 (C#/VB/C++).

属性

OnlineIdServiceTicketRequest类 具有以下属性。

属性访问类型描述

Policy

只读The policy used to authenticate users. Supported values are JWT, which returns data using the JSON format. For apps that are requesting user consent to access stored in Live, app developer must pass a policy of DELEGATION.

Service

只读Identifies the service your app uses. The service name must match the DNS name you supplied when registering your app on http://go.microsoft.com/fwlink/p/?linkid=241860. Tickets are issued only for this service. For apps that are requesting user consent to access stored in Live, you must pass the offers to which your app needs access. The available list of offers can be found at our Scopes and Permissions page. The ticket can then be used with the Live Connect REST apis to access data that a user has consented to give to the app. Check out our REST APIs topic to learn more. Alternatively, the app can use the Live Connect SDK which will make these calls itself.

 

示例

下面的示例显示如何指定用于验证活动用户的服务和策略。


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

 

 

显示:
© 2015 Microsoft