Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/auth0/agent-skills --skill auth0-maui- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads auth0-maui automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
auth0-maui Integration
Add Auth0 authentication to .NET MAUI applications targeting iOS, Android, macOS, and Windows. This skill integrates the Auth0.OidcClient.MAUI NuGet package which uses the system browser via MAUI's WebAuthenticator for secure OIDC-based login and logout flows with PKCE.
Agent instruction: Before providing SDK setup instructions, fetch the latest MAUI release version by running:
gh api repos/auth0/auth0-oidc-client-net/releases --jq '[.[] | select(.tag_name | startswith("maui-")) | .tag_name | ltrimstr("maui-")] | .[0]'Use the returned version in all dependency lines instead of any hardcoded version below.
Prerequisites
- .NET 8.0 SDK or later
- Visual Studio 2022 (17.8+) with MAUI workload, or JetBrains Rider with MAUI support
- For iOS: macOS with Xcode 15+
- For Android: Android SDK API 33+ (net8.0) or API 34+ (net9.0)
- For Windows: Windows 10 (10.0.19041.0)+
- Auth0 account with a Native application configured
- Node.js 20+ (for Auth0 CLI automated setup)
When NOT to Use
| Use Case | Recommended Skill |
|---|---|
| ASP.NET Core server-side web app | auth0-aspnetcore-authentication |
| ASP.NET Core Web API (JWT validation) | auth0-aspnetcore-api |
| React Native mobile app | auth0-react-native |
| iOS-only Swift app | auth0-swift |
| Android-only Kotlin app | auth0-android |
| Expo React Native app | auth0-expo |
Quick Start Workflow
Agent instruction: Before starting, examine the user's project:
- Identify the .NET version from the
.csprojfile (TargetFrameworks)- Check for existing authentication implementations — search for existing login/logout handlers and hook into them if found
- Note the project's namespace and directory conventions
- Look for existing
Auth0ClientorAuth0ClientOptionsusage to avoid duplicate configuration
- Install SDK:
dotnet add package Auth0.OidcClient.MAUI - Configure Auth0: See Setup Guide for automatic or manual configuration.
- Integrate authentication: Add
Auth0Clientinstantiation and wire login/logout to UI actions.- IMPORTANT: Always set
Scope = "openid profile email offline_access"— theoffline_accessscope is required to receive a refresh token for silent token renewal.
- IMPORTANT: Always set
- Persist tokens with SecureStorage: After login, store the refresh token using
await SecureStorage.Default.SetAsync("refresh_token", loginResult.RefreshToken). On app startup, restore the session withRefreshTokenAsync. Clear on logout withSecureStorage.Default.Remove("refresh_token"). - Register URL scheme: Configure platform-specific callback handling:
- Android: Create
WebAuthenticatorActivitywith IntentFilter for your custom scheme (e.g.,myapp) - Windows (two steps required): (1) Add
<uap:Extension Category="windows.protocol"><uap:Protocol Name="myapp"/></uap:Extension>toPlatforms/Windows/Package.appxmanifest, AND (2) callActivator.Default.CheckRedirectionActivation()inPlatforms/Windows/App.xaml.cs - iOS/macOS: No extra configuration needed
- Android: Create
- Build and verify:
dotnet build
Agent instruction: When writing the Auth0Client configuration:
- ALWAYS include
offline_accessin the Scope string — without it, no refresh token is returned and the user must re-authenticate every time the access token expires.- ALWAYS implement token persistence using
SecureStorage.Default.SetAsync("refresh_token", ...)after login andSecureStorage.Default.GetAsync("refresh_token")on app startup to restore sessions silently.- Clear stored tokens on logout with
SecureStorage.Default.Remove("refresh_token").- ALWAYS create/update
Platforms/Windows/Package.appxmanifestto register the custom URL scheme protocol. Without this, Windows will not intercept the callback URL after authentication. Add a<uap:Extension Category="windows.protocol"><uap:Protocol Name="myapp"/></uap:Extension>inside the<Extensions>element of the<Application>node.- ALWAYS add
CheckRedirectionActivation()inPlatforms/Windows/App.xaml.csas the first line in the constructor, beforeInitializeComponent().After writing configuration and code, verify the build succeeds:
dotnet buildIf the build fails, attempt to fix the issue. After 5-6 failed attempts, ask the user for help.
Callback URL Configuration
The MAUI SDK uses a custom URL scheme for callbacks. The default pattern is:
myapp://callback
Unlike other Auth0 native SDKs that use https://{domain}/{platform}/{bundleId}/callback or
{bundleId}.auth0://{domain}/ios/{bundleId}/callback patterns, MAUI uses a simpler custom scheme
approach. You can customize the scheme (e.g., com.mycompany.myapp://callback). Whatever scheme you choose must be:
- Registered in Auth0 Dashboard under Allowed Callback URLs and Allowed Logout URLs
- Configured in the platform-specific callback handler (Android
IntentFilter, WindowsPackage.appxmanifest) - Set in
Auth0ClientOptions.RedirectUriandAuth0ClientOptions.PostLogoutRedirectUri
Note: For production apps, use a reverse-domain scheme (e.g.,
com.yourcompany.yourapp://callback) to reduce the risk of URL scheme hijacking.
Done When
-
Auth0.OidcClient.MAUIpackage installed -
Auth0Clientconfigured with Domain, ClientId, andScopeincludingoffline_access - URL scheme registered on Android (WebAuthenticatorCallbackActivity) and Windows (Package.appxmanifest)
- Callback URL (
myapp://callback) added to Auth0 Dashboard Allowed Callback URLs and Allowed Logout URLs - Login/logout flow working
- Refresh token persisted via
SecureStorage.Default.SetAsyncafter login - Session restoration implemented via
SecureStorage.Default.GetAsync+RefreshTokenAsyncon app startup - Build succeeds with no errors
- Tested on physical device or emulator/simulator
Detailed Documentation
- Setup Guide — Auth0 tenant configuration, SDK installation, platform-specific callback setup
- Integration Patterns — Login/logout flows, token refresh, user profile, error handling, MVVM patterns
- API Reference & Testing — Full
Auth0ClientOptionsreference, claims, testing checklist, troubleshooting
Common Mistakes
| Mistake | Fix |
|---|---|
| App type not set to Native in Auth0 Dashboard | Change application type to "Native" in Dashboard settings |
| Missing callback URL in Auth0 Dashboard | Add myapp://callback (or your scheme) to Allowed Callback URLs AND Allowed Logout URLs |
Android: Missing WebAuthenticatorCallbackActivity | Create activity class with [IntentFilter] matching your callback scheme |
Windows: Not calling CheckRedirectionActivation() | Add Activator.Default.CheckRedirectionActivation() at start of Windows App.xaml.cs, before InitializeComponent() |
Using https:// prefix in Domain | Domain should be hostname only (e.g., tenant.auth0.com, not https://tenant.auth0.com) |
Not requesting offline_access scope for token refresh | Add offline_access to Scope in Auth0ClientOptions to get a refresh token |
| RedirectUri/PostLogoutRedirectUri not matching Dashboard | Ensure the exact URI (scheme + path) matches what's configured in Auth0 Dashboard |
| Not registering URL scheme on Android/Windows | Register the custom URL scheme in platform-specific config (see Platform setup step) |
| Storing tokens in plain text | Use SecureStorage from MAUI Essentials for persisting refresh tokens |
Testing Notes
Agent instruction: Remind the user to test on a physical device in addition to emulators/simulators. Some WebAuthenticator behaviors (system browser integration, URL scheme interception) may differ on physical devices vs. emulators. Test the full login → callback → token flow on real hardware before shipping.
Testing Checklist:
- Login flow: System browser opens → authenticate → returns to app
- Logout flow: Browser opens → session cleared → returns to app
- Token refresh:
RefreshTokenAsyncwith stored refresh token works - Cancel: User cancels login → app handles
UserCancelgracefully - Physical device: Test on real iOS/Android device (not just simulator)
- Offline: Verify token refresh works when the app is restarted
- Multi-platform: Test on at least one mobile platform (iOS or Android) and Windows
Related Skills
- auth0-aspnetcore-authentication — ASP.NET Core server-side web apps
- auth0-aspnetcore-api — ASP.NET Core Web API with JWT validation
- auth0-android — Android-native Kotlin apps
- auth0-swift — iOS/macOS Swift apps
- auth0-react-native — React Native mobile apps
- auth0-net-android-ios — .NET Android/iOS (non-MAUI)
Quick Reference
using Auth0.OidcClient;
// Initialize client
var client = new Auth0Client(new Auth0ClientOptions
{
Domain = "YOUR_AUTH0_DOMAIN",
ClientId = "YOUR_AUTH0_CLIENT_ID",
RedirectUri = "myapp://callback",
PostLogoutRedirectUri = "myapp://callback",
Scope = "openid profile email offline_access"
});
// Login — opens system browser
var loginResult = await client.LoginAsync();
if (!loginResult.IsError)
{
var user = loginResult.User;
var accessToken = loginResult.AccessToken;
var idToken = loginResult.IdentityToken;
var refreshToken = loginResult.RefreshToken;
// Access user claims
var name = user.FindFirst("name")?.Value;
var email = user.FindFirst("email")?.Value;
// Persist refresh token securely for session restoration
if (!string.IsNullOrEmpty(refreshToken))
await SecureStorage.Default.SetAsync("refresh_token", refreshToken);
}
// Logout — clears Auth0 session and stored tokens
await client.LogoutAsync();
SecureStorage.Default.Remove("refresh_token");
// Restore session on app startup (no user interaction needed)
var savedToken = await SecureStorage.Default.GetAsync("refresh_token");
if (!string.IsNullOrEmpty(savedToken))
{
var refreshResult = await client.RefreshTokenAsync(savedToken);
if (!refreshResult.IsError)
{
var newAccessToken = refreshResult.AccessToken;
// Update stored token if rotated
if (!string.IsNullOrEmpty(refreshResult.RefreshToken))
await SecureStorage.Default.SetAsync("refresh_token", refreshResult.RefreshToken);
}
else
{
// Refresh failed — clear and require re-login
SecureStorage.Default.Remove("refresh_token");
}
}
// Get user info from /userinfo endpoint
var userInfo = await client.GetUserInfoAsync(accessToken);
// Login with extra parameters (organization, audience, connection)
var orgLogin = await client.LoginAsync(new { organization = "org_abc123" });
var apiLogin = await client.LoginAsync(new { audience = "https://my-api.example.com" });
Android Callback Activity (Required)
[Activity(NoHistory = true, LaunchMode = LaunchMode.SingleTop, Exported = true)]
[IntentFilter(new[] { Intent.ActionView },
Categories = new[] { Intent.CategoryDefault, Intent.CategoryBrowsable },
DataScheme = CALLBACK_SCHEME)]
public class WebAuthenticatorActivity : Microsoft.Maui.Authentication.WebAuthenticatorCallbackActivity
{
const string CALLBACK_SCHEME = "myapp";
}
Windows Platform Setup (Required — Both Steps)
Step 1: Register protocol in Platforms/Windows/Package.appxmanifest:
<Extensions>
<uap:Extension Category="windows.protocol">
<uap:Protocol Name="myapp"/>
</uap:Extension>
</Extensions>
Step 2: Handle redirection in Platforms/Windows/App.xaml.cs:
// In Platforms/Windows/App.xaml.cs
public App()
{
if (Auth0.OidcClient.Platforms.Windows.Activator.Default.CheckRedirectionActivation())
return;
this.InitializeComponent();
}
References
FAQ
What does the auth0-maui skill do?
Use when adding Auth0 login, logout, or token management to a .NET MAUI cross-platform app (iOS, Android, macOS, or Windows). Integrates Auth0.OidcClient.MAUI — use even if the user says "add login to my MAUI app".
How do I install auth0-maui?
Run npx skills add https://github.com/auth0/agent-skills --skill auth0-maui in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/auth0-maui/ (personal) or .claude/skills/auth0-maui/ (project).
Which AI agents can use auth0-maui?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is auth0-maui safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains auth0-maui?
It is published by auth0 in auth0/agent-skills. It has 223 recorded installs.
More from auth0/agent-skills
auth0
auth0/agent-skills
Use when adding, fixing, or improving how an app authenticates users or protects an API, or when using or configuring any Auth0 feature — signing users in and out, sessions and tokens, guarding routes and endpoints, MFA, passwordless passkey login (WebAuthn), SSO, Organizations, RBAC, custom domains, Universal Portals for hosted account and organization self-service, or Universal Login branding. Also use to audit a tenant's health, security, and plan fit (CheckMate), to debug why an auth flow fails, to migrate from another auth provider, or to set up the Vercel native integration. Covers any web, mobile, or backend framework and every Auth0 SDK, tool, and API. Use even if the user never mentions Auth0.
auth0-quickstart
auth0/agent-skills
Use when adding Auth0 authentication to any app and unsure which SDK or skill to use. Detects the project's framework and routes to the right setup workflow — use this as the entry point even if the user just says "add login to my app" or "set up Auth0" without naming a framework.
auth0-nextjs
auth0/agent-skills
Use when adding Auth0 login, logout, protected pages, or middleware to a Next.js application. Supports App Router and Pages Router with @auth0/nextjs-auth0 — use even if the user says "add login to my Next.js app" or "protect my Next.js routes".
auth0-react
auth0/agent-skills
Use when adding Auth0 login, logout, protected routes, or user sessions to a React SPA. Integrates @auth0/auth0-react — use even if the user says "add login to my React app" or "protect my React routes" without naming the SDK.
auth0-react-native
auth0/agent-skills
Use when adding Auth0 login, logout, or biometric auth to a bare React Native app (not Expo). Integrates react-native-auth0 with native deep linking.
auth0-express
auth0/agent-skills
Use when adding session-based login, logout, or protected routes to an Express.js web application. Integrates express-openid-connect — use even if the user says "add login to my Express app" or "protect my Express routes".
Popular mobile skills
design-mobile-apps
designed-by-ai/skills
Design mobile app screens with Sleek, edit Sleek projects, and implement their designs in React Native or HTML.
ios-design
uizze.sh
Design and review iOS UI/UX for iPhone apps in SwiftUI, UIKit, or React Native. Use for mobile app design, screen redesigns, navigation flows, typography, forms, keyboard and safe-area layout, and accessibility checks. Apply Apple Human Interface Guidelines and consult real product references through the optional Uizze connection.
vercel-react-native-skills
vercel-labs/agent-skills
React Native and Expo best practices for building performant mobile apps. Use when building React Native components, optimizing list performance, implementing animations, or working with native modules. Triggers on tasks involving React Native, Expo, mobile performance, or native platform APIs.
animate-expo
emilkowalski/skills
Build animations in React Native and Expo, making the decisions in the order that determines whether they feel right — should it animate, which thread it runs on, which properties, spring or timing, how the gesture hands off, how it degrades. Writes the implementation with Reanimated, Gesture Handler, Expo Router and expo-haptics. Use when animating anything in an Expo app, adding gestures, sheets, screen transitions, press feedback or haptics, or fixing motion that stutters on device. For web animation use animate.
xcode-project-setup
firebase/agent-skills
Safely modifies Xcode projects (.pbxproj) to add Swift Packages and link files. Use this skill whenever an iOS project needs dependencies installed (e.g. Firebase, Alamofire).
firebase-remote-config-basics
firebase/agent-skills
Manages Firebase Remote Config templates, feature flags, loading strategies, and SDKs (Android, iOS). Use when downloading/deploying remoteconfig JSON templates, managing version history/feature flags, setting in-app defaults, fetchAndActivate(), real-time listeners, or SDK setup. Don't use for Firebase Hosting, Auth, Firestore, Data Connect, Crashlytics, or App Hosting.
