
auth0-android
Use when adding Auth0 login, logout, or credential management to an Android app in Kotlin or Java. Covers Web Auth, biometric-protected CredentialsManager, and MFA — even if the user just says "add login to my Android app" without mentioning Auth0. Integrates com.auth0.android:auth0.
- Installs
- 482
- 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-android- 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-android 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 Android Integration
Add authentication to Android applications using com.auth0.android:auth0.
Agent instruction: Before providing SDK setup instructions, fetch the latest release version by running:
gh api repos/auth0/Auth0.Android/releases/latest --jq '.tag_name'Use the returned version in all
implementationdependency lines instead of any hardcoded version below. If the command fails, fall back to checking https://github.com/auth0/Auth0.Android/releases.
Prerequisites
- Android API 21 or higher
- Kotlin or Java project
- Auth0 account with a Native application configured
- If you don't have Auth0 set up, see auth0-quickstart
When NOT to Use
- React Native apps: Use auth0-react-native
- Flutter apps: Use the native Flutter Auth0 SDK
- Web SPAs (React, Angular, Vue): Use auth0-react, auth0-angular, or auth0-vue
- Node.js/Express servers: Use auth0-express
- iOS/macOS apps: Use auth0-swift
Quick Start Workflow
-
Install SDK: Add the Auth0 Android SDK dependency to your
build.gradle:implementation 'com.auth0.android:auth0:{LATEST_VERSION}' -
Configure Auth0:
Agent instruction: Check whether the user prompt already includes both Auth0 Client ID and Domain.
- If both are provided, proceed directly to Manual Setup in Setup Guide using those values.
- If either is missing, you MUST ask the user BEFORE writing any code or files:
- Question: "How would you like to configure Auth0 for this project?"
- Options: "Automatic setup (Recommended) — Auth0 CLI creates the app and writes credentials to strings.xml" / "Manual setup — I'll provide my Client ID and Domain"
Then follow Setup Guide for the chosen path. Do NOT proceed to step 3 until Auth0 credentials are confirmed.
Note: For native Android apps, Domain and Client ID are public configuration (not secrets). No client secret is used. Write values directly to
strings.xmlwithout displaying them in conversation output. -
Initialize: Create an Auth0 account instance:
import com.auth0.android.Auth0 val account = Auth0.getInstance(context)IMPORTANT:
Auth0.getInstance(context)auto-readscom_auth0_client_idandcom_auth0_domainfromstrings.xml. Never passclientIdordomainas arguments (e.g.Auth0.getInstance(clientId, domain)) — that hardcodes credentials in source. -
Add Auth UI: Implement login and logout with Web Auth:
Agent instruction: Before adding new UI elements, search the project for existing click handlers for login, logout, sign-in, or sign-out buttons (e.g.,
loginButton,signInButton,logoutButton,signOutButton, orsetOnClickListenerwith auth-related naming). If existing handlers are found, hook the Auth0 code into them without modifying the existing UI. Only create new buttons if no existing handlers are found.Login:
import com.auth0.android.Auth0 import com.auth0.android.authentication.AuthenticationAPIClient import com.auth0.android.authentication.storage.SecureCredentialsManager import com.auth0.android.authentication.storage.SharedPreferencesStorage import com.auth0.android.callback.Callback import com.auth0.android.authentication.AuthenticationException import com.auth0.android.provider.WebAuthProvider import com.auth0.android.result.Credentials val account = Auth0.getInstance(context) val authentication = AuthenticationAPIClient(account) val storage = SharedPreferencesStorage(context) val credentialsManager = SecureCredentialsManager(context, authentication, storage) WebAuthProvider.login(account) .withScheme(getString(R.string.com_auth0_scheme)) .withScope("openid profile email offline_access") .start(this, object : Callback<Credentials, AuthenticationException> { override fun onSuccess(result: Credentials) { // User authenticated val idToken = result.idToken val accessToken = result.accessToken // Store credentials securely credentialsManager.saveCredentials(result) } override fun onFailure(error: AuthenticationException) { // Handle authentication failure Log.e("Auth0", "Authentication failed", error) } })Logout:
WebAuthProvider.logout(account) .withScheme(getString(R.string.com_auth0_scheme)) .start(this, object : Callback<Void?, AuthenticationException> { override fun onSuccess(result: Void) { // User logged out } override fun onFailure(error: AuthenticationException) { Log.e("Auth0", "Logout failed", error) } }) -
Build & Verify:
Agent instruction: After completing the integration, build the project to verify it compiles successfully:
./gradlew assembleDebugIf the build fails, analyze the error output and fix the issues. Common integration build failures include:
- Unresolved reference: Missing import statements — add the required
import com.auth0.android.*imports - Cannot resolve symbol
R.string.com_auth0_scheme:strings.xmlnot updated — verifycom_auth0_scheme,com_auth0_client_id, andcom_auth0_domainentries exist - Incompatible types in callback: Callback type parameters don't match — ensure
Callback<Credentials, AuthenticationException>for login andCallback<Void?, AuthenticationException>for logout - Unresolved
lifecycleScope: Missing dependency — addimplementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.+'or move code out of coroutine scope - minSdk too low: SDK requires API 21+ — update
minSdkVersionto at least 21 - Java version mismatch: SDK requires Java 8 — add
compileOptionswithJavaVersion.VERSION_1_8
Re-run the build after each fix. Track the number of build-fix iterations.
Failcheck: If the build still fails after 5–6 fix attempts, stop and ask the user:
- Question: "The build is still failing after several fix attempts. How would you like to proceed?"
- Options: "Let the agent continue fixing iteratively" / "I'll fix it manually — show me the errors" / "Skip build verification and proceed"
Repeat this check after every 5–6 iterations if errors persist. Do not leave the project in a non-compiling state without the user's explicit consent.
The callback URL must match your Auth0 application settings:
{SCHEME}://{YOUR_AUTH0_DOMAIN}/android/{YOUR_APP_PACKAGE_NAME}/callback - Unresolved reference: Missing import statements — add the required
Detailed Documentation
- Setup Guide — Install SDK, configure Auth0 application, set up callback URLs, Android App Links, custom schemes, ProGuard/R8
- Integration Patterns — Web Auth login/logout, credential storage, biometric authentication, database login, passwordless authentication, MFA handling, custom tabs, error handling
- Testing & Reference — Testing checklist, common issues, security considerations, API reference
Common Mistakes
| Mistake | Fix |
|---|---|
| App type not set to Native in Auth0 Dashboard | Create a Native application type in your Auth0 tenant. The Android SDK requires Native app configuration, not Machine-to-Machine or other types. |
| Missing callback URL in Allowed Callback URLs | Add {SCHEME}://{YOUR_AUTH0_DOMAIN}/android/{YOUR_APP_PACKAGE_NAME}/callback to your Auth0 application's Allowed Callback URLs setting, where {SCHEME} matches com_auth0_scheme in strings.xml (e.g., demo by default). |
Missing <uses-permission android:name="android.permission.INTERNET" /> | Add the INTERNET permission to AndroidManifest.xml. The SDK requires network access for authentication. |
| Custom scheme in lowercase | Android requires scheme names to be lowercase. Use https (recommended) or lowercase custom scheme like myapp://callback. |
Forgetting .validateClaims() on direct auth calls | Always call .validateClaims() when using AuthenticationAPIClient directly (for database, passwordless, or API login). Web Auth validates automatically. |
| Storing tokens in SharedPreferences without encryption | Use SecureCredentialsManager to store credentials. Never store tokens manually in plain text. The manager encrypts tokens at rest. |
| Missing manifest placeholders | Add manifestPlaceholders = [auth0Domain: "@string/com_auth0_domain", auth0Scheme: "@string/com_auth0_scheme"] to your build.gradle defaultConfig block. |
Related Skills
- auth0-quickstart — Set up an Auth0 account and application
- auth0-mfa — Configure multi-factor authentication
- auth0-swift — iOS/macOS authentication
- auth0-cli — Manage Auth0 resources from the terminal
Quick Reference
Core Classes
| Class | Purpose |
|---|---|
Auth0 | Entry point for SDK, holds app credentials |
WebAuthProvider | OAuth 2.0 login/logout via browser |
AuthenticationAPIClient | Direct API calls (database login, passwordless, MFA) |
SecureCredentialsManager | Secure storage and retrieval of credentials |
Credentials | User tokens and expiration |
Common Use Cases
- Log in with Web Auth
- Log out
- Store credentials securely
- Require biometric authentication
- Database login
- Passwordless authentication
- Handle MFA
- Call protected APIs
References
FAQ
What does the auth0-android skill do?
Use when adding Auth0 login, logout, or credential management to an Android app in Kotlin or Java. Covers Web Auth, biometric-protected CredentialsManager, and MFA — even if the user just says "add login to my Android app" without mentioning Auth0. Integrates com.auth0.android:auth0.
How do I install auth0-android?
Run npx skills add https://github.com/auth0/agent-skills --skill auth0-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-android/ (personal) or .claude/skills/auth0-android/ (project).
Which AI agents can use auth0-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-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-android?
It is published by auth0 in auth0/agent-skills, and it is an official skill from the maker of the technology it covers. It has 482 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.