Sign in Get 3 free credits

Try a job or a niche: tiktok captions, study notes, excel formulas. Press Esc to close.

.NET MAUI sign in

Adds Google, Apple and Microsoft sign in to your .NET MAUI app, so login works on Android, iOS and Windows.

What we improved

SKILL.md now carries the setup code, not only the gotchas: the WebAuthenticator call and per platform registration, Sign in with Apple, Entra app registration, a complete MSAL client with silent then interactive calls, Android, iOS and Wind

Improved by YourAISkill from the original by davidortinau, under its MIT licence. The download includes the author's licence and a CHANGES.md listing every change. Both Claude reviews read the improved version.

Claude's review

8/10 Working MAUI auth code for WebAuthenticator, Apple sign-in and MSAL, with the per-platform setup steps that silently break sign-in, plus a token handler and checklists.

We asked Claude the question you would ask: would I be glad I installed this? Two separate reviews, the second blind to the first, must both rate a skill 7 or higher before we sell it.

In detail

Add authentication to .NET MAUI apps. Covers WebAuthenticator for generic OAuth 2.0 / social login, and MSAL.NET for Microsoft Entra ID (Azure AD) with broker support (Microsoft Authenticator), token caching, Conditional Access, platform-specific setup (Android, iOS, Windows), DelegatingHandler for bearer token API calls, and Blazor Hybrid integration. USE FOR: "add authentication", "OAuth login", "MSAL.NET", "social login", "WebAuthenticator", "Entra ID MAUI", "Azure AD login", "Google login MAUI", "Apple login MAUI", "token caching", "bearer token", "sign in". DO NOT USE FOR: secure local storage of tokens (use maui-secure-storage), Aspire-specific auth setup (use maui-aspire), or server-side Entra ID provisioning (use entra-id-aspire-provisioning).

How you use it

  1. Add it to your pack, then download your pack (1 credit).
  2. In Claude, open Customize > Skills and upload the zip. Code execution needs to be on under Settings > Capabilities.
  3. Ask Claude for the job in your own words. It uses the skill when your request matches what it does. Step by step guide

Safety check

Nothing risky found: no hidden instructions, no download and run, no reading of saved passwords or keys.

An automated scan lowers risk but cannot promise zero risk. How we check skills

Preview

The first lines of SKILL.md
---
name: maui-authentication
description: "Add sign-in to .NET MAUI apps with working setup code and the platform gotchas that break it. Covers WebAuthenticator for generic OAuth 2.0 and social login (Google, Apple, any OIDC provider) through your own server, native Sign in with Apple, and MSAL.NET for Microsoft Entra ID (Azure AD): app registration, Android, iOS and Windows setup, optional broker (Microsoft Authenticator, WAM), token cache, silent then interactive token calls, a DelegatingHandler for bearer tokens, and Blazor Hybrid auth state. Use for: add authentication, OAuth login, social login, WebAuthenticator, MSAL.NET, Entra ID or Azure AD login in MAUI, Google or Apple login in MAUI, token caching, bearer token API calls, sign in and sign out. Not for server-side API protection or general secure storage design beyond storing tokens."
---
<!-- Modified by YourAISkill (youraiskill.com) on 2 December 2026 from the original by davidortinau. See CHANGES.md. -->

# .NET MAUI Authentication

Full classes (login view model, Blazor component, server endpoint) are in `references/authentication-api.md`. This file carries the method and the code you need to get a first sign-in working.

## 1. Pick the approach

| Situation | Use |
|---|---|
| Users sign in with Microsoft Entra ID (work or school, Microsoft Graph, Conditional Access, MFA) | MSAL.NET (`Microsoft.Identity.Client`) |
| Google, Facebook, GitHub, Apple on Android or Windows, or your own OIDC server | WebAuthenticator plus a small endpoint on your server |
| Sign in with Apple on iOS | `AppleSignInAuthenticator` (native sheet) |
| Any OIDC provider that supports public clients with PKCE, and you want no server in the loop | An OIDC client library such as IdentityModel.OidcClient (now published by Duende) driving the system browser. WebAuthenticator alone does not do PKCE or the code exchange. |

Never put a client secret, API key or signing key in the app. Anything in the binary can be extracted. A mobile app is a public client: either the server holds the secret (WebAuthenticator pattern below) or the flow uses authorization code with PKCE, which needs no secret.

## 2. WebAuthenticator (server mediated OAuth)

Flow: the app opens `https://your-server/mobileauth/Google`; the server runs the normal ASP.NET Core OAuth handler (it holds the secret), then redirects to `myapp://#access_token=...`; WebAuthenticator catches that URI and returns its parameters.

```csharp
try
{
    var result = await WebAuthenticator.Default.AuthenticateAsync(new WebAuthenticatorOptions
    {
        Url = new Uri("https://your-server.example/mobileauth/Google"),
        CallbackUrl = new Uri("myapp://"),
        PrefersEphemeralWebBrowserSession = true // iOS 13+: no shared Safari cookies
    });

    var accessToken = result.AccessToken;   // null if the server did not send one
    var refreshToken = result.RefreshToken; // use the property; Properties["refresh_token"] throws when absent
    await SecureStorage.Default.SetAsync("access_token", accessToken ?? "");
}
catch (TaskCanceledException)
...

From davidortinau's repository, MIT licence.

Related skills

  • Checked

    TUnit tests for .NET

    Writes, runs and fixes TUnit tests in .NET, or moves xUnit and NUnit tests across, so your suite runs cleanly.

    by managedcode 527
    8/101 credit
  • Checked

    .NET trimming and Native AOT

    Fixes trimming and Native AOT warnings in your .NET code step by step, so your app publishes small and fast.

    by Aaronontheweb 1.3k
    9/101 credit
  • Checked

    MAUI safe area layout

    Handles safe areas and edge to edge layouts in .NET MAUI, so content clears notches and the keyboard.

    by dotnet 6.4k
    7/101 credit
  • Checked

    Xamarin.Forms to .NET MAUI

    Moves your Xamarin.Forms app to .NET MAUI and keeps its store identity and user data, so nothing breaks quietly.

    by davidortinau 181
    8/101 credit
  • Checked

    Godot C# scripting

    Writes, ports and debugs C# scripts for Godot 4, so your game builds and runs without the common C# traps.

    by jame581 1k
    8/101 credit
  • Checked

    .NET Native Interop Helper

    Writes correct P/Invoke calls from .NET to C and C++ libraries, avoiding crashes, leaks and garbled text.

    by dotnet 6.4k
    8/101 credit

Secure checkout

Credits

AUD

  1. 1Choose
  2. 2Pay on Square
  3. 3Credits added