Show / Hide Table of Contents

Class WebAuthenticator

Handles OAuth redirection to the system browser and re-activation.

Inheritance
object
WebAuthenticator
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: WinUIEx
Assembly: WinUIEx.dll
Syntax
[Obsolete("Use Windows App SDK's Microsoft.Security.Authentication.OAuth APIs instead.")]
public sealed class WebAuthenticator
Remarks

Your app must be configured for OAuth with schema activation. The scheme must be the first part of the url, ie if your oauth redirection url starts with for instance myappscheme://signin/, the scheme would be myappscheme. Note that http(s) schemes are not supported here.

If your app is packaged, in your app's Package.appxmanifest under Declarations, add a Protocol declaration and add the scheme you registered for your application's oauth redirect url under "Name".

If your app is unpackaged, make sure you register the application for protocol activation.

try
{
    Microsoft.Windows.AppLifecycle.ActivationRegistrationManager.RegisterForProtocolActivation("myappscheme", "Assets\\Square150x150Logo.scale-100", "My App Name", null);
    var result = await WebAuthenticator.AuthenticateAsync(authorizeUri, callbackUri, cancellationToken);
}
finally
{
    Microsoft.Windows.AppLifecycle.ActivationRegistrationManager.UnregisterForProtocolActivation("myappscheme", null);
}

Methods

Name Description
AuthenticateAsync(Uri, Uri)

Begin an authentication flow by navigating to the specified url and waiting for a callback/redirect to the callbackUrl scheme.

AuthenticateAsync(Uri, Uri, CancellationToken)

Begin an authentication flow by navigating to the specified url and waiting for a callback/redirect to the callbackUrl scheme.

CheckOAuthRedirectionActivation(AppActivationArguments?, bool)

Performs an OAuth protocol activation check and redirects activation to the correct application instance.

CheckOAuthRedirectionActivation(bool)

Performs an OAuth protocol activation check and redirects activation to the correct application instance.

  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX