Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/auth0/agent-skills --skill auth0-net-ios- 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-net-ios 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-net-ios Integration
Add Auth0 authentication to .NET iOS applications. This skill integrates the Auth0.OidcClient.iOS NuGet package which uses ASWebAuthenticationSession 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("ios-")) | .tag_name | ltrimstr("ios-")] | .[0]'Use the returned version in all dependency lines instead of any hardcoded version below.
Prerequisites
- .NET 8.0 SDK or later (.NET 9 also supported — use
net9.0-iostarget framework) - JetBrains Rider or VS Code with C# Dev Kit (with iOS workload)
- macOS with Xcode 15+
- iOS 14.0+ deployment target
- Auth0 account with a Native application configured
- Node.js 20+ (for Auth0 CLI automated setup)
When NOT to Use
| Use Case | Recommended Skill |
|---|---|
| .NET MAUI cross-platform app (iOS + Android + Windows) | auth0-maui |
| .NET Android-only app | auth0-net-android |
| iOS-only Swift app | auth0-swift |
| 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 |
Quick Start Workflow
Agent instruction: Before starting, examine the user's project:
- Identify the .NET version from the
.csprojfile (TargetFramework)- 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)
- Note the project's Bundle Identifier from
Info.plistor.csproj- Look for existing
Auth0ClientorAuth0ClientOptionsusage to avoid duplicate configuration
- Install SDK:
dotnet add package Auth0.OidcClient.iOS - Configure Auth0: See Setup Guide for automatic or manual configuration.
- Integrate authentication: Add
Auth0Clientinstantiation, register the URL scheme inInfo.plist, and wire login/logout to UI actions. - Handle callback: Implement
OpenUrlinAppDelegateand callActivityMediator.Instance.Send(url.AbsoluteString). - Build and verify:
dotnet build
Agent instruction: When writing the Auth0Client configuration:
- The iOS SDK does NOT require passing an Activity context — just
new Auth0Client(options).- Always set
Scope = "openid profile email offline_access"— theoffline_accessscope is required to receive refresh tokens, enabling silent token renewal without re-prompting the user.- The callback URL is automatically derived from the Bundle Identifier:
{BundleId}://{domain}/ios/{BundleId}/callback.- The Bundle Identifier must be registered as a URL scheme in
Info.plist.- The
AppDelegatemust handleOpenUrland callActivityMediator.Instance.Send(url.AbsoluteString).- Store tokens securely: After successful login, persist
AccessTokenandRefreshTokenusing iOS Keychain (viaSecurityframework or a wrapper likeKeychainAccess). Never store tokens inUserDefaultsor in-memory variables only.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.
WebAuth — How Authentication Works
The SDK uses ASWebAuthenticationSession (the secure system browser). When LoginAsync() is called:
- SDK constructs the
/authorizeURL with PKCE parameters (code verifier + challenge) - ASWebAuthenticationSession opens showing the Auth0 login page
- User authenticates (login form, social connections, MFA, etc.)
- Auth0 redirects to the native callback URL:
{BundleId}://{domain}/ios/{BundleId}/callback - iOS intercepts the URL scheme and delivers it to
AppDelegate.OpenUrl ActivityMediator.Instance.Send(url.AbsoluteString)completes the token exchange- SDK returns
LoginResultwith access token, ID token, refresh token, and user claims
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 iOS uses the Bundle Identifier as the scheme. The format is:
YOUR_BUNDLE_IDENTIFIER://YOUR_AUTH0_DOMAIN/ios/YOUR_BUNDLE_IDENTIFIER/callback
Where YOUR_BUNDLE_IDENTIFIER is the Bundle Identifier for your application, such as com.mycompany.myapplication. For example: com.mycompany.myapp://tenant.us.auth0.com/ios/com.mycompany.myapp/callback.
Note: Some Auth0 native SDKs use
https://{domain}/ios/{bundleId}/callbackor{bundleId}.auth0://{domain}/ios/{bundleId}/callbackas the callback URL format. The .NET iOS SDK uses the Bundle Identifier directly as the URL scheme.
Ensure that the Callback URL is in lowercase.
This URL must be:
- Registered in Auth0 Dashboard under Allowed Callback URLs and Allowed Logout URLs
- Registered as a URL scheme in
Info.plistunderCFBundleURLSchemes
Done When
-
Auth0.OidcClient.iOSpackage installed (latest stable version) -
Auth0Clientconfigured with Domain, ClientId, andScope = "openid profile email offline_access" - URL scheme registered in
Info.plistmatching the Bundle Identifier -
AppDelegate.OpenUrlimplemented withActivityMediator.Instance.Send(url.AbsoluteString) - Callback URL added to Auth0 Dashboard Allowed Callback URLs and Allowed Logout URLs
- Tokens stored securely using iOS Keychain (
Securityframework withSecKeyChain.Add) - Login/logout flow working
- Build succeeds with no errors
Detailed Documentation
- Setup Guide — Auth0 tenant configuration, SDK installation, Info.plist URL scheme setup
- Integration Patterns — Login/logout flows, token access, user profile, error handling
- 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 yourbundleid://{domain}/ios/yourbundleid/callback to Allowed Callback URLs AND Allowed Logout URLs |
| Missing URL scheme in Info.plist | Add CFBundleURLSchemes entry matching your Bundle Identifier |
Not handling OpenUrl in AppDelegate | Override OpenUrl and call ActivityMediator.Instance.Send(url.AbsoluteString) |
Using https:// prefix in Domain | Domain should be hostname only (e.g., tenant.auth0.com, not https://tenant.auth0.com) |
| Passing Activity context to Auth0Client (Android pattern) | iOS does not need context — just new Auth0Client(options) |
| URL scheme not matching Bundle Identifier | The CFBundleURLSchemes value must exactly match the Bundle Identifier |
Storing tokens in UserDefaults or only in memory | Use iOS Keychain via the Security framework (SecKeyChain.Add) for token persistence |
Testing Notes
Agent instruction: Remind the user to test on a physical device in addition to simulators. Some WebAuth/ASWebAuthenticationSession behaviors may differ on physical devices vs. simulators. Test the full login → callback → token flow on real hardware before shipping.
Physical Device Testing:
- Login flow: ASWebAuthenticationSession opens → authenticate → returns to app
- Callback:
OpenUrlfires in AppDelegate with correct URL - Logout flow: Browser opens → session cleared → returns to app
- Cancel: User dismisses sheet → app handles
UserCancelgracefully
Related Skills
- auth0-maui — .NET MAUI cross-platform apps (iOS + Android + Windows)
- auth0-net-android — .NET Android-only apps
- auth0-swift — iOS-only Swift 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"
});
var loginResult = await client.LoginAsync();
BrowserResultType browserResult = await client.LogoutAsync();
Agent instruction: Always include
offline_accessin the scope to enable refresh tokens. This allows the app to silently refresh access tokens without forcing the user to re-authenticate.Agent instruction: After login, always persist tokens to the iOS Keychain using the
Securityframework (SecKeyChain.AddwithSecAccessible.WhenUnlockedThisDeviceOnly). Never store tokens inUserDefaultsor leave them only in memory. Clear tokens on logout. See Integration Patterns for the fullSecureTokenStoragehelper class.
Required Platform Configuration
These two pieces are required for the callback to work — see Setup Guide for full code:
- Info.plist: Add
CFBundleURLSchemesentry matching the Bundle Identifier - AppDelegate: Override
OpenUrland callActivityMediator.Instance.Send(url.AbsoluteString)
For login with extra parameters, error handling, token refresh, user claims access, and complete ViewController examples, see Integration Patterns.
References
FAQ
What does the auth0-net-ios skill do?
Use when adding Auth0 login or token management to a .NET iOS application. Integrates Auth0.OidcClient.iOS — use even if the user says "add login to my .NET iOS app" or references Xamarin iOS.
How do I install auth0-net-ios?
Run npx skills add https://github.com/auth0/agent-skills --skill auth0-net-ios 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-ios/ (personal) or .claude/skills/auth0-net-ios/ (project).
Which AI agents can use auth0-net-ios?
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-ios 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-ios?
It is published by auth0 in auth0/agent-skills. It has 221 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.
