MCPInstall

auth0-net-android

Use when adding Auth0 login or token management to a .NET Android application. Integrates Auth0.OidcClient.AndroidX — use even if the user says "add login to my .NET Android app" or references Xamarin Android.

Installs
219
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/auth0/agent-skills --skill auth0-net-android
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads auth0-net-android automatically when relevant.

  3. 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-net-android Integration

Add Auth0 authentication to .NET Android applications. This skill integrates the Auth0.OidcClient.AndroidX NuGet package which uses Chrome Custom Tabs for secure OIDC-based login and logout flows with PKCE.

Agent instruction: Before providing SDK setup instructions, fetch the latest release version by running:

gh api repos/auth0/auth0-oidc-client-net/releases --jq '[.[] | select(.tag_name | startswith("androidx-")) | .tag_name | ltrimstr("androidx-")] | .[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 .NET Android workload, or JetBrains Rider
  • Android SDK API 21+ (minimum), API 34+ recommended for net9.0-android
  • Auth0 account with a Native application configured
  • Node.js 20+ (for Auth0 CLI automated setup)

When NOT to Use

Use CaseRecommended Skill
.NET MAUI cross-platform app (iOS + Android + Windows)auth0-maui
.NET iOS-only appauth0-net-ios
Android-only Kotlin appauth0-android
ASP.NET Core server-side web appauth0-aspnetcore-authentication
ASP.NET Core Web API (JWT validation)auth0-aspnetcore-api
React Native mobile appauth0-react-native

Quick Start Workflow

Agent instruction: Before starting, examine the user's project:

  1. Identify the .NET version from the .csproj file (TargetFramework)
  2. Check for existing authentication implementations — search for existing login/logout handlers and hook into them if found (reuse existing UI elements like login buttons rather than creating duplicates)
  3. Note the project's namespace and package name from the .csproj or AndroidManifest.xml
  4. Look for existing Auth0Client or Auth0ClientOptions usage to avoid duplicate configuration
  1. Install SDK: dotnet add package Auth0.OidcClient.AndroidX
  2. Configure Auth0: See Setup Guide for automatic or manual configuration.
  3. Integrate authentication: Add Auth0Client instantiation, configure the IntentFilter on your Activity, and wire login/logout to UI actions.
  4. Handle callback: Override OnNewIntent and call ActivityMediator.Instance.Send(intent.DataString) to complete the authentication flow.
  5. Build and verify: dotnet build

Agent instruction: When writing the Auth0Client configuration:

  • Pass this (the Activity) as the second argument to Auth0Client constructor.
  • Always set Scope = "openid profile email offline_access" — the offline_access scope is required to receive refresh tokens, enabling silent token renewal without re-prompting the user.
  • The callback URL format is YOUR_ANDROID_PACKAGE_NAME://YOUR_AUTH0_DOMAIN/android/YOUR_ANDROID_PACKAGE_NAME/callback — all lowercase.
  • The DataScheme in the IntentFilter must be lowercase or Android will not receive callbacks.
  • Set LaunchMode = LaunchMode.SingleTask on the Activity to prevent duplicate instances. Do NOT use SingleTop — it does not correctly handle the callback redirect and will create duplicate Activity instances.
  • The Activity should either extend Auth0ClientActivity OR manually override OnNewIntent and call ActivityMediator.Instance.Send(intent.DataString).
  • Store tokens securely: After successful login, persist AccessToken and RefreshToken using SecureStorage (MAUI/Essentials) or EncryptedSharedPreferences (AndroidX Security — requires dotnet add package Xamarin.AndroidX.Security.SecurityCrypto). Never store tokens in plain SharedPreferences or in-memory variables only.

After writing configuration and code, verify the build succeeds:

dotnet build

If the build fails, attempt to fix the issue. After 5-6 failed attempts, ask the user for help.

WebAuth — How Authentication Works

The SDK uses the WebAuth pattern via Chrome Custom Tabs (the system browser). When LoginAsync() is called, the SDK:

  1. Constructs the /authorize URL with PKCE parameters
  2. Opens Chrome Custom Tabs with the authorization URL
  3. After authentication, Auth0 redirects to the native callback URL
  4. The Android system matches the URL scheme and delivers it to your Activity via OnNewIntent
  5. ActivityMediator completes the token exchange

This is the standard OAuth 2.0 Authorization Code flow with PKCE, recommended for native mobile applications.

Callback URL Configuration

The native callback URL for .NET Android uses the package name as the scheme. The format is:

YOUR_ANDROID_PACKAGE_NAME://YOUR_AUTH0_DOMAIN/android/YOUR_ANDROID_PACKAGE_NAME/callback

Where YOUR_ANDROID_PACKAGE_NAME is the Package Name for your application, such as com.mycompany.myapplication. For example: com.mycompany.myapp://tenant.us.auth0.com/android/com.mycompany.myapp/callback.

Note: Some Auth0 native SDKs use https://{domain}/android/{package}/callback as the callback URL format. The .NET Android SDK uses the package name as the URL scheme instead.

Ensure that the Callback URL is in lowercase.

This URL must be:

  1. Registered in Auth0 Dashboard under Allowed Callback URLs and Allowed Logout URLs
  2. Matched by the IntentFilter attributes (DataScheme, DataHost, DataPathPrefix) on your Activity

Done When

  • Auth0.OidcClient.AndroidX package installed (latest stable version)
  • Auth0Client configured with Domain, ClientId, and Scope = "openid profile email offline_access"
  • IntentFilter configured on Activity with correct DataScheme, DataHost, DataPathPrefix
  • LaunchMode = LaunchMode.SingleTask set on Activity
  • OnNewIntent handled with ActivityMediator.Instance.Send(intent.DataString)
  • Callback URL added to Auth0 Dashboard Allowed Callback URLs and Allowed Logout URLs
  • Tokens stored securely (SecureStorage or EncryptedSharedPreferences)
  • Login/logout flow working
  • Build succeeds with no errors

Detailed Documentation

  • Setup Guide — Auth0 tenant configuration, SDK installation, IntentFilter setup
  • Integration Patterns — Login/logout flows, token access, user profile, error handling
  • API Reference & Testing — Full Auth0ClientOptions reference, claims, testing checklist, troubleshooting

Common Mistakes

MistakeFix
App type not set to Native in Auth0 DashboardChange application type to "Native" in Dashboard settings
Missing callback URL in Auth0 DashboardAdd yourpackagename://{domain}/android/yourpackagename/callback to Allowed Callback URLs AND Allowed Logout URLs
DataScheme not lowercaseAndroid requires the scheme to be lowercase — use lowercase package name
Missing LaunchMode.SingleTaskSet LaunchMode = LaunchMode.SingleTask on the Activity to prevent duplicate instances
Not handling OnNewIntentOverride OnNewIntent and call ActivityMediator.Instance.Send(intent.DataString)
Using https:// prefix in DomainDomain should be hostname only (e.g., tenant.auth0.com, not https://tenant.auth0.com)
Not passing Activity context to Auth0ClientPass this as second parameter: new Auth0Client(options, this)
IntentFilter DataHost/DataPathPrefix mismatchEnsure DataHost matches your Auth0 domain and DataPathPrefix is /android/yourpackagename/callback
Missing offline_access scopeAlways include offline_access in Scope to receive refresh tokens for silent renewal
Using LaunchMode.SingleTop instead of SingleTaskMust use LaunchMode.SingleTask — SingleTop does not correctly handle the Auth0 callback redirect
Storing tokens in plain SharedPreferencesUse SecureStorage or EncryptedSharedPreferences from AndroidX Security library

Testing Notes

Agent instruction: Remind the user to test on a physical device in addition to emulators. Some WebAuth behaviors (Chrome Custom Tabs, URL scheme interception) may differ on physical devices vs. emulators. Test the full login → callback → token flow on real hardware before shipping.

Physical Device Testing:

  • Login flow: Chrome Custom Tab opens → authenticate → returns to app
  • Callback: OnNewIntent fires with correct intent data
  • Logout flow: Browser opens → session cleared → returns to app
  • Cancel: User presses back → app handles UserCancel gracefully

Related Skills

  • auth0-maui — .NET MAUI cross-platform apps (iOS + Android + Windows)
  • auth0-net-ios — .NET iOS-only apps
  • auth0-android — Android-native Kotlin apps
  • auth0-aspnetcore-authentication — ASP.NET Core server-side web apps
  • auth0-aspnetcore-api — ASP.NET Core Web API with JWT validation

Quick Reference

using Auth0.OidcClient;

var client = new Auth0Client(new Auth0ClientOptions
{
    Domain = "YOUR_AUTH0_DOMAIN",
    ClientId = "YOUR_AUTH0_CLIENT_ID",
    Scope = "openid profile email offline_access"
}, this);

Login

var loginResult = await client.LoginAsync();

Handle Errors

var loginResult = await client.LoginAsync();

if (loginResult.IsError)
{
    Debug.WriteLine($"An error occurred during login: {loginResult.Error}");
}

Access Tokens

var loginResult = await client.LoginAsync();

if (!loginResult.IsError)
{
    Debug.WriteLine($"Authentication successful.");
}

User Information

if (!loginResult.IsError)
{
    Debug.WriteLine($"name: {loginResult.User.FindFirst(c => c.Type == "name")?.Value}");
    Debug.WriteLine($"email: {loginResult.User.FindFirst(c => c.Type == "email")?.Value}");
}

List All Claims

if (!loginResult.IsError)
{
    foreach (var claim in loginResult.User.Claims)
    {
        Debug.WriteLine($"{claim.Type} = {claim.Value}");
    }
}

Logout

BrowserResultType browserResult = await client.LogoutAsync();

Activity with IntentFilter (Required)

[Activity(Label = "AndroidSample", MainLauncher = true, Icon = "@drawable/icon",
    LaunchMode = LaunchMode.SingleTask)]
[IntentFilter(
    new[] { Intent.ActionView },
    Categories = new[] { Intent.CategoryDefault, Intent.CategoryBrowsable },
    DataScheme = "YOUR_ANDROID_PACKAGE_NAME",
    DataHost = "YOUR_AUTH0_DOMAIN",
    DataPathPrefix = "/android/YOUR_ANDROID_PACKAGE_NAME/callback")]
public class MainActivity : Activity
{
    // Code omitted
}

Handle Callback in OnNewIntent (Required)

protected override async void OnNewIntent(Intent intent)
{
    base.OnNewIntent(intent);

    Auth0.OidcClient.ActivityMediator.Instance.Send(intent.DataString);
}

References

FAQ

What does the auth0-net-android skill do?

Use when adding Auth0 login or token management to a .NET Android application. Integrates Auth0.OidcClient.AndroidX — use even if the user says "add login to my .NET Android app" or references Xamarin Android.

How do I install auth0-net-android?

Run npx skills add https://github.com/auth0/agent-skills --skill auth0-net-android 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-net-android/ (personal) or .claude/skills/auth0-net-android/ (project).

Which AI agents can use auth0-net-android?

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-net-android 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-net-android?

It is published by auth0 in auth0/agent-skills. It has 219 recorded installs.

More from auth0/agent-skills

View all →

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.

Backend & APIs5.3K installs

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.

OfficialAI & Agents2.7K installs

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".

OfficialFrontend & Design1.6K installs

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.

OfficialFrontend & Design1.5K installs

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.

OfficialFrontend & Design963 installs

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".

OfficialBackend & APIs816 installs

Popular mobile skills

View category →

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.

Mobile1.1M installs

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.

Mobile416.5K installs

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.

OfficialMobile256.7K installs

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.

Mobile140.1K installs

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).

OfficialMobile131.2K installs

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.

OfficialMobile121.7K installs