.NET MAUI › Security & Authentication

How do you implement OAuth/OpenID Connect login in MAUI?

Intermediate

Answer

Use WebAuthenticator.Default.AuthenticateAsync to launch a secure system browser for the provider's authorize URL and capture the redirect callback, then exchange the code for tokens. Register a custom URL scheme/callback per platform. Libraries like IdentityModel.OidcClient can handle PKCE and token exchange.
var result = await WebAuthenticator.Default.AuthenticateAsync(
    new Uri("https://idp/authorize?..."),
    new Uri("myapp://callback"));
var token = result.AccessToken;
Real-world example Users sign in with their corporate identity provider through the system browser and return to the app with tokens.

Common follow-ups: What is PKCE? | Why use the system browser over an embedded webview?