共用方式為


WebAccountProviderRequestTokenOperation 類別

定義

表示要求權杖作業。

public ref class WebAccountProviderRequestTokenOperation sealed : IWebAccountProviderTokenOperation, IWebAccountProviderUIReportOperation
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class WebAccountProviderRequestTokenOperation final : IWebAccountProviderTokenOperation, IWebAccountProviderUIReportOperation
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class WebAccountProviderRequestTokenOperation : IWebAccountProviderTokenOperation, IWebAccountProviderUIReportOperation
Public NotInheritable Class WebAccountProviderRequestTokenOperation
Implements IWebAccountProviderTokenOperation, IWebAccountProviderUIReportOperation
繼承
Object Platform::Object IInspectable WebAccountProviderRequestTokenOperation
屬性
實作

Windows 需求

裝置系列
Windows 10 (已於 10.0.10240.0 引進)
API contract
Windows.Foundation.UniversalApiContract (已於 v1.0 引進)

範例

下列示範如何處理要求權杖作業的範例:

WebAccountProviderRequestTokenOperation webAccountProviderRequestTokenOperation;
string accessToken;

protected override void OnNavigatedTo(NavigationEventArgs e)
{
    this.webAccountProviderRequestTokenOperation = 
        (WebAccountProviderRequestTokenOperation)e.Parameter;
    base.OnNavigatedTo(e);
}

private void Authentication_Click(object sender, RoutedEventArgs e)
{
    Uri uri;
    if (webAccountProviderRequestTokenOperation != null)
    {
        // Build the URI using information about the web account from the request
        uri = new Uri("INSERT URI HERE"); 
    }
    else
    {
        // Build the Uri using user-entered information
        uri = new Uri("INSERT URI HERE"); 
    }
    // Complete authentication using the built Uri
    WebTokenResponse response = new WebTokenResponse(this.accessToken);
    WebProviderTokenResponse providerResponse = 
        new WebProviderTokenResponse(response, DateTimeOffset.Now.AddHours(1));
    webAccountProviderRequestTokenOperation.ProviderResponses.Add(providerResponse);
    // Return the result
    WebAccountManager.SendTokenResultCompleted(webAccountProviderOperation);
}    

屬性

CacheExpirationTime

取得或設定快取到期時間。

Kind

取得 Web 帳戶提供者作業的種類。

ProviderRequest

取得 Web 提供者權杖要求。

ProviderResponses

取得 Web 提供者權杖回應。

方法

ReportCompleted()

通知啟動的應用程式作業已順利完成。

ReportError(WebProviderError)

通知啟動的應用程式作業發生錯誤。

ReportUserCanceled()

通知啟動的應用程式使用者已取消作業。

適用於

另請參閱