---
title: "How to Add Authentication to .NET MAUI Apps"
description: "This tutorial shows how to add Okta-based authentication to a .NET MAUI application, covering project setup, OpenID Connect configuration, sign-in, sign-out, and platform integration. It uses IdentityModel.OidcClient, an OktaClient wrapper, an OktaClientConfiguration class, and a WebBrowserAuthenticator implementation to connect the application to Okta’s browser-based authorization flow. The walkthrough creates a native OIDC client with the Okta CLI, registers redirect and logout URIs using myapp://callback, configures dependency injection, and updates the UI to display claims after login. For Android, it adds a WebAuthenticationCallbackActivity with an intent filter for the myapp scheme and enables Custom Tabs visibility in AndroidManifest.xml. The post includes troubleshooting for NuGet configuration and runtime-pack errors, but notes that the Okta CLI was deprecated and the original instructions no longer work exactly as written after the May 2025 plan change."
---

# How to Add Authentication to .NET MAUI Apps

[Okta](https://yomu.fyi/company/okta) · Laura Rodríguez · Jun 21, 2023

**Type:** Tutorial

## Summary

This tutorial shows how to add Okta-based authentication to a .NET MAUI application, covering project setup, OpenID Connect configuration, sign-in, sign-out, and platform integration. It uses IdentityModel.OidcClient, an OktaClient wrapper, an OktaClientConfiguration class, and a WebBrowserAuthenticator implementation to connect the application to Okta’s browser-based authorization flow. The walkthrough creates a native OIDC client with the Okta CLI, registers redirect and logout URIs using myapp://callback, configures dependency injection, and updates the UI to display claims after login. For Android, it adds a WebAuthenticationCallbackActivity with an intent filter for the myapp scheme and enables Custom Tabs visibility in AndroidManifest.xml. The post includes troubleshooting for NuGet configuration and runtime-pack errors, but notes that the Okta CLI was deprecated and the original instructions no longer work exactly as written after the May 2025 plan change.

## Context

The sample uses Windows 11, Visual Studio 2022 version 17.4.5, .NET 7, and the Okta CLI. The platform-specific walkthrough focuses on Android, while pointing to a separate Auth0-based article for iOS support.

## Approach / What changed

Create a .NET MAUI application, install IdentityModel.OidcClient, and implement OktaClient, OktaClientConfiguration, and WebBrowserAuthenticator. Configure a native OIDC application with redirect and logout URIs, register the Okta client through dependency injection, connect login and logout controls to the UI, then add Android callback activity and manifest changes for the myapp scheme. Because the Okta CLI was deprecated, current setup requires manually configuring Okta according to its developer documentation.

## Takeaways

- IdentityModel.OidcClient handles the OIDC login and logout flows, while OktaClient exposes LoginAsync and LogoutAsync methods around that dependency.
- The sample uses myapp://callback for both the redirect URI and logout redirect URI, and the Android callback activity registers myapp as an intent-filter scheme.
- The original Okta CLI instructions are preserved for reference but no longer work exactly as written after the May 2025 plan change; manual Okta configuration is required.

## FAQ

### How does the MAUI app receive the browser authentication callback on Android?

The app adds WebAuthenticationCallbackActivity, which derives from WebAuthenticatorCallbackActivity and declares an intent filter for the myapp scheme. AndroidManifest.xml also adds a Custom Tabs service query so the intent is visible.

### What does the sample show after a successful sign-in?

The login result supplies the authenticated user and claims. The UI hides the login view, displays the home view, lists the claims, and sets a greeting using the name claim when available.

### Can the Okta CLI steps still be followed as written?

No. The post notes that the Okta CLI was deprecated and that the instructions no longer work exactly as written after the May 2025 Okta Integrator Free Plan change. Okta must be configured manually using its developer documentation.

**Tags:** [Android](https://yomu.fyi/topic/android), [.NET](https://yomu.fyi/topic/dotnet), [Okta](https://yomu.fyi/topic/okta), [OpenID Connect](https://yomu.fyi/topic/openid-connect)

- Source: [Okta](https://developer.okta.com/blog/2023/06/21/net-maui-authentication)
- Source URL: https://developer.okta.com/blog/2023/06/21/net-maui-authentication
- Ingested by Yomu: 2026-09-17T14:13:06.138Z

[Read original post](https://developer.okta.com/blog/2023/06/21/net-maui-authentication)
