Langsung ke konten
Skillpedia
API & server (backend)7.6k Β· #13137

authentication

Fungsinya

Skill ini menjelaskan cara autentikasi bekerja di aplikasi Agent-Native, yang memakai Better Auth. Cakupannya meliputi mode pengembangan dan produksi, perlindungan rute kustom, dan organisasi. Skill ini untuk pengembang yang menyiapkan atau memperbaiki login.

Kapan dipakai

  • βœ“Saat Anda menambahkan pendaftaran atau login ke aplikasi Agent-Native.
  • βœ“Ketika Anda ingin melindungi rute kustom agar hanya pengguna yang sudah masuk yang bisa memakainya.
  • βœ“Saat pengguna mengalami masalah sesi dan Anda perlu mencari tahu penyebabnya.

Link skill

https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/authentication/SKILL.md

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/authentication/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit β†’

Contoh permintaan ke AI

β€œBisakah Anda menyiapkan pendaftaran dan login untuk aplikasi Agent-Native saya, dengan masuk lewat Google sebagai salah satu pilihan?”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Skill ini menjelaskan bagaimana pengguna baru mendapatkan akun pada kunjungan pertama, bagaimana sesi diperiksa, dan metode masuk apa saja yang tersedia di produksi.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.

Authentication

Rule

Auth is powered by Better Auth with account-first design. Every new user creates an account on first visit. Use getSession(event) to authenticate custom routes; actions are auto-protected. Normal app HTML and React Router page-data responses are one impersonal, public-cacheable shell for every visitor. The client decides whether to render private UI or redirect to sign-in.

Auth Modes

Mode Behavior
Development (default) Real Better Auth β€” same flow as production. There is no auth bypass. On first run the framework auto-creates a throwaway dev account and signs you in without printing its credentials (disable with AGENT_NATIVE_DISABLE_AUTO_DEV_ACCOUNT=1), so you are not stuck at a login wall. getSession() returns the signed-in user or null β€” it never falls back to a sentinel identity.
Production (default) Magic-link-first Better Auth when outbound email is ready, with email/password fallback and social providers (Google, GitHub). Organizations built in.
AUTH_MODE=local Not a browser auth bypass, and never returns local@localhost. It only affects CLI/agent identity: it lets pnpm action / the local agent loop auto-bind to the single real signed-in dev user from the sessions table (see scripts/dev-session.ts). Browser login is unchanged.
AUTH_SKIP_EMAIL_VERIFICATION=1 QA/preview escape hatch for password-fallback accounts. Signup skips email verification and does not send the signup verification email. Local dev/test skips verification by default; set AUTH_SKIP_EMAIL_VERIFICATION=0 only when testing verification itself. It does not change magic-link delivery. Give test accounts a test-identity address, such as an-e2e-probe-you@example.com or one containing +qa-test-bot- (the rule is isTestIdentityEmail in packages/core/src/shared/qa-test-email.ts), so they stay out of metrics. Test identities still get sign-in, verification, password-reset, and org-invitation mail, but no share notices or other app email.
auth.requireEmailVerification Declares the password-signup verification policy for any environment, production included, via defineAppConfig({ auth: { requireEmailVerification: false } }) or AUTH_REQUIRE_EMAIL_VERIFICATION=0. A declared value outranks AUTH_SKIP_EMAIL_VERIFICATION and the per-environment default. false accepts an unverified address as a login credential; true with no email provider disables password signup instead of stranding accounts on a verification nobody can deliver.
AUTH_MAGIC_LINK=0 Force the email/password fallback even when outbound email is ready.
AUTH_DISABLED=true Skip login/signup entirely β€” every request runs as dev@local.test. For local dev, cloud previews, and internal demos only; not for production with real users.
ACCESS_TOKEN / ACCESS_TOKENS Static bearer fallback for MCP/connect clients that cannot use OAuth. Not browser auth and never a token login page.
Custom Pass your own getSession to autoMountAuth(app, { getSession }).

Auth emails (verify signup, reset password, magic link, email change) and org invites render through renderTransactionalEmail. An app changes their copy or design with overrideTransactionalEmail(id, render) from a server plugin, never by editing better-auth-instance.ts call sites. See /docs/deployment#email-templates.

Hosted Sign-In Pages and the Shared Wave

  • First-party server auth plugins use createToolkitAuthPlugin from @agent-native/toolkit/app/auth/server. It server-renders AuthPage and ResetPasswordPage before hydration. Direct Core createAuthPlugin calls leave generic fallback markup in the response and can flash before React replaces it.
  • AuthPage uses Toolkit's full-page WaveBackground for every auth view. The Agent-Native homepage hero and Calendar booking use the same renderer: Calendar's animated FFT ocean wave. Keep the background empty while WebGPU support is checked and when the ocean renderer is unavailable
Pertanyaan umum

Apakah ada cara untuk melewati login saat pengembangan?

Skill ini menyatakan tidak ada jalan pintas autentikasi. Pada saat pertama dijalankan, akun pengembangan dibuat secara otomatis.

Bagaimana rute kustom dilindungi?

Rute kustom memakai pemeriksaan sesi, dan aksi dilindungi secara otomatis.

Opsi masuk apa saja yang ada di produksi?

Skill ini menyebutkan tautan masuk lewat email, cadangan email dan kata sandi, serta masuk sosial dengan Google dan GitHub.

Detail

Deskripsi asli dari pembuat

How auth works in agent-native apps. Use when wiring login/signup, configuring auth modes, setting up organizations, protecting routes, or debugging session issues.

repo: BuilderIO/agent-native

Popularitas

Bintang GitHub
7.6k
Peringkat
#13137
Lisensi
MIT
Diperbarui
2/11/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa