auth0-quickstart

bởi auth0

Bộ định tuyến phát hiện framework và thiết lập tài khoản Auth0 cho chín framework JavaScript và backend. Phát hiện stack của bạn (React, Next.js, Vue, Nuxt, Angular, Express, Fastify, React Native) và chuyển hướng đến kỹ năng framework cụ thể phù hợp. Cung cấp lệnh cài đặt CLI Auth0 và tạo ứng dụng cho SPA, ứng dụng web thông thường và ứng dụng gốc. Bao gồm hướng dẫn thiết lập biến môi trường và tài liệu tham khảo lỗi thường gặp cho từng tầng framework. Đề cập đến các mẫu di chuyển từ Firebase, Cognito,...

npx skills add https://github.com/auth0/agent-skills --skill auth0-quickstart

Auth0 Quickstart

Detect your framework and get started with Auth0 authentication.


Step 1: Detect Your Framework

Run this command to identify your framework:

# Check package.json dependencies (Node.js projects)
cat package.json | grep -E "react|next|vue|nuxt|angular|express|fastify|@nestjs|expo"

# Or check project files
ls -la | grep -E "angular.json|vue.config.js|next.config|app.json|Package.swift|build.gradle"

Framework Detection Table:

FrameworkDetectionSkill to Use
React (Vite/CRA)"react" in package.json, no Next.jsauth0-react
Next.js"next" in package.jsonauth0-nextjs
Vue.js"vue" in package.json, no Nuxtauth0-vue
Nuxt"nuxt" in package.jsonauth0-nuxt
Angularangular.json exists or "@angular/core"auth0-angular
Express.js"express" in package.jsonauth0-express
Fastify (web app)"fastify" in package.json, has @fastify/viewauth0-fastify
Fastify (API)"fastify" in package.json, no view engineauth0-fastify-api
React Native"react-native" or "expo" in package.jsonauth0-react-native
Flask"flask" in requirements.txt, Pipfile, or pyproject.tomlauth0-flask
Node.js API"express-oauth2-jwt-bearer" in package.jsonexpress-oauth2-jwt-bearer
ASP.NET Core web app*.csproj exists, has Views/ or Pages/ folderauth0-aspnetcore-authentication

Don't see your framework? See Tier 2 Frameworks below.


Step 2: Auth0 Account Setup

Install Auth0 CLI

macOS/Linux:

brew install auth0/auth0-cli/auth0

Windows:

scoop install auth0
# Or: choco install auth0-cli

Full installation guide: See CLI Reference

Login to Auth0

auth0 login

This opens your browser to authenticate with Auth0.


Step 3: Create Auth0 Application

Choose application type based on your framework:

Single Page Applications (React, Vue, Angular):

auth0 apps create --name "My App" --type spa \
  --auth-method None \
  --callbacks "http://localhost:3000" \
  --logout-urls "http://localhost:3000" \
  --metadata "created_by=agent_skills"

Regular Web Apps (Next.js, Nuxt, Express, Fastify):

auth0 apps create --name "My App" --type regular \
  --callbacks "http://localhost:3000/api/auth/callback" \
  --logout-urls "http://localhost:3000" \
  --metadata "created_by=agent_skills"

Native Apps (React Native):

auth0 apps create --name "My App" --type native \
  --auth-method None \
  --callbacks "myapp://callback" \
  --logout-urls "myapp://logout" \
  --metadata "created_by=agent_skills"

Get your credentials:

auth0 apps list          # Find your app
auth0 apps show <app-id> # Get client ID and secret

More CLI commands: See CLI Reference

Apply Branding (Optional)

After creating your application, apply branding so the Auth0 Universal Login page matches your app:

auth0 ul update \
  --accent "#YOUR_BRAND_COLOR" \
  --background "#YOUR_BACKGROUND_COLOR" \
  --logo "https://your-app.com/logo.png" \
  --favicon "https://your-app.com/favicon.ico"

This ensures users see your app's branding on the login screen instead of the default Auth0 branding. You can also use the acul-screen-generator skill for full custom login screen design.


Step 4: Use Framework-Specific Skill

Based on your framework detection, use the appropriate skill:

Tier 1 Frameworks (Dedicated Skills)

Frontend:

  • auth0-react - React SPAs (Vite, Create React App)
  • auth0-nextjs - Next.js (App Router and Pages Router)
  • auth0-vue - Vue.js 3 applications
  • auth0-nuxt - Nuxt 3/4 applications
  • auth0-angular - Angular 12+ applications

Backend:

  • auth0-express - Express.js web applications
  • auth0-flask - Flask web applications
  • auth0-fastify - Fastify web applications
  • auth0-fastify-api - Fastify API authentication
  • express-oauth2-jwt-bearer - Node.js/Express API JWT Bearer validation
  • auth0-aspnetcore-authentication - ASP.NET Core MVC, Razor Pages, Blazor Server web applications

Mobile:

  • auth0-react-native - React Native and Expo (iOS/Android)

Tier 2 Frameworks (Use Auth0 Docs)

Not yet available as separate skills. Use Auth0 documentation:

Frontend:

Backend:

Mobile:


Migration from Other Providers

Migrating from another auth provider? Use the auth0-migration skill.

The migration skill covers:

  • User export from Firebase, Cognito, Supabase, Clerk, etc.
  • Bulk import to Auth0
  • Code migration patterns (before/after examples)
  • JWT validation updates
  • Gradual migration strategies

Reference Documentation

Environment Variables

Framework-specific environment variable setup:

Auth0 Concepts

Core concepts and troubleshooting:

CLI Commands

Complete Auth0 CLI reference:


Common Mistakes

MistakeFix
Wrong application typeSPAs need "Single Page Application", server apps need "Regular Web Application", mobile needs "Native"
Callback URL not configuredAdd your app's callback URL to Allowed Callback URLs in Auth0 Dashboard
Using wrong credentialsClient Secret only needed for Regular Web Apps, not SPAs
Hardcoding credentials in codeAlways use environment variables, never commit secrets to git
Not testing locally firstSet up localhost URLs in Auth0 before deploying to production
Mixing application typesDon't use SPA SDK for server-side apps or vice versa

Related Skills

Core Integration

  • auth0-migration - Migrate from other auth providers

SDK Skills

  • auth0-spa-js - SPA integration
  • auth0-react - React SPA integration
  • auth0-nextjs - Next.js integration
  • auth0-vue - Vue.js integration
  • auth0-nuxt - Nuxt 3/4 integration
  • auth0-angular - Angular integration
  • auth0-express - Express.js integration
  • auth0-flask - Flask web app integration
  • auth0-fastify - Fastify web app integration
  • auth0-fastify-api - Fastify API integration
  • express-oauth2-jwt-bearer - Node.js/Express API JWT Bearer validation
  • auth0-react-native - React Native CLI (bare workflow) integration
  • auth0-expo - Expo (managed workflow) integration
  • auth0-android - Android (Kotlin/Java) integration
  • auth0-swift - iOS/macOS (Swift) integration
  • auth0-fastapi-api - FastAPI API authentication
  • auth0-aspnetcore-authentication - ASP.NET Core web app authentication
  • auth0-aspnetcore-api - ASP.NET Core API authentication

Advanced Features

  • auth0-mfa - Multi-Factor Authentication

References

Thêm skills từ auth0

acul-screen-generator
auth0
Tạo ra các triển khai màn hình Auth0 Advanced Custom Universal Login (ACUL) hoàn chỉnh, có thương hiệu bằng cách sử dụng React hoặc Vanilla JS SDK. Sử dụng khi nhà phát triển yêu cầu…
official
auth0-android
auth0
Sử dụng khi thêm xác thực vào ứng dụng Android (Kotlin/Java) với Web Auth, thông tin xác thực được bảo vệ bằng sinh trắc học và MFA - tích hợp…
official
auth0-angular
auth0
Sử dụng khi thêm xác thực vào ứng dụng Angular với route guards và HTTP interceptors - tích hợp SDK @auth0/auth0-angular cho SPA
official
auth0-aspnetcore-api
auth0
Sử dụng khi bảo vệ các điểm cuối ASP.NET Core Web API bằng xác thực token JWT Bearer, kiểm tra phạm vi/quyền, hoặc xác thực không trạng thái - tích hợp…
official
auth0-cli
auth0
Tài liệu tham khảo cho các lệnh Auth0 CLI — ứng dụng, api, người dùng, vai trò, tổ chức, hành động, nhật ký, tên miền tùy chỉnh, universal-login, terraform, chế độ API thô, và --json…
official
auth0-expo
auth0
Sử dụng khi thêm xác thực vào ứng dụng di động Expo (React Native) — đăng nhập, đăng xuất, phiên người dùng, tuyến đường được bảo vệ, sinh trắc học hoặc quản lý token. Tích hợp…
official
auth0-express
auth0
Sử dụng khi thêm xác thực (đăng nhập, đăng xuất, route được bảo vệ) vào ứng dụng web Express.js - tích hợp express-openid-connect cho xác thực dựa trên phiên.
official
auth0-fastapi-api
auth0
Sử dụng khi bảo vệ các điểm cuối API FastAPI với xác thực token JWT Bearer, kiểm tra phạm vi/quyền, hoặc xác thực phi trạng thái - tích hợp auth0-fastapi-api cho REST…
official