Jaa


WebAccountProviderGetTokenSilentOperation Class

Definition

Represents a get token silently operation.

public ref class WebAccountProviderGetTokenSilentOperation sealed : IWebAccountProviderSilentReportOperation, IWebAccountProviderTokenOperation
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class WebAccountProviderGetTokenSilentOperation final : IWebAccountProviderSilentReportOperation, IWebAccountProviderTokenOperation
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class WebAccountProviderGetTokenSilentOperation : IWebAccountProviderSilentReportOperation, IWebAccountProviderTokenOperation
Public NotInheritable Class WebAccountProviderGetTokenSilentOperation
Implements IWebAccountProviderSilentReportOperation, IWebAccountProviderTokenOperation
Inheritance
Object Platform::Object IInspectable WebAccountProviderGetTokenSilentOperation
Attributes
Implements

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Examples

The following demonstrates how to handle a get token silently operation:

void HandleGetTokenSilently(WebAccountProviderGetTokenSilentOperation operation)
{
    try
    {
        WebProviderTokenRequest webProviderTokenRequest = operation.ProviderRequest;
        WebTokenRequest tokenRequest = webProviderTokenRequest.ClientRequest;

        // authenticate silently with the tokenrequest and get back an access token
        WebTokenResponse response = new WebTokenResponse(accessToken); 

        // Add any desired properties to send with the response
        response.Properties.Add("responsePropertyKey1", "responesPropertyValue1");
        response.Properties.Add("responsePropertyKey2", "responsePropertyValue2");

        // send the response
        WebProviderTokenResponse providerResponse = new WebProviderTokenResponse(response, 
                                                        DateTimeOffset.Now.AddHours(1));
        IList<WebProviderTokenResponse> responses = operation.Responses;
        responses.Add(providerResponse);
        operation.ReportCompleted();
    }
    catch (Exception ex)
    {
        WebProviderError error = new WebProviderError(ERROR_CODE, ex.Message);
        operation.ReportError(error);
    }
}

Properties

CacheExpirationTime

Gets or sets the cache expiration time.

Kind

Gets the kind of web account provider operation.

ProviderRequest

Gets the web provider token request.

ProviderResponses

Gets the web provider token responses.

Methods

ReportCompleted()

Informs the activating app that the operation completed successfully.

ReportError(WebProviderError)

Informs the activating app that the operation encountered an error.

ReportUserInteractionRequired()

Informs the activating app that user interaction is required to continue the operation.

ReportUserInteractionRequired(WebProviderError)

Informs the activating app that an error has occurred and user interaction is required to continue the operation.

Applies to

See also