authentication
하는 일
이 스킬은 Better Auth를 사용하는 Agent-Native 앱의 인증 방식을 설명합니다. 개발 모드와 운영 모드, 사용자 정의 경로 보호, 조직을 다룹니다. 로그인을 설정하거나 고치는 개발자를 위한 스킬입니다.
사용하는 경우
- ✓Agent-Native 앱에 가입이나 로그인을 추가할 때.
- ✓로그인한 사용자만 쓸 수 있도록 사용자 정의 경로를 보호하고 싶을 때.
- ✓사용자에게 세션 문제가 있고 원인을 찾아야 할 때.
스킬 링크
https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/authentication/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“Google 로그인을 선택지로 포함해서 내 Agent-Native 앱에 가입과 로그인을 설정해 주실 수 있나요?”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
이 스킬은 새 사용자가 처음 방문할 때 계정을 얻는 방식, 세션을 확인하는 방식, 운영 환경에서 쓸 수 있는 로그인 방법을 설명합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 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
createToolkitAuthPluginfrom@agent-native/toolkit/app/auth/server. It server-rendersAuthPageandResetPasswordPagebefore hydration. Direct CorecreateAuthPlugincalls leave generic fallback markup in the response and can flash before React replaces it. AuthPageuses Toolkit's full-pageWaveBackgroundfor 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
자주 묻는 질문
개발 중에 로그인을 건너뛸 방법이 있나요?
이 스킬은 인증 우회 기능이 없다고 말합니다. 처음 실행하면 개발용 계정이 자동으로 만들어집니다.
사용자 정의 경로는 어떻게 보호하나요?
사용자 정의 경로는 세션 확인을 사용하고, 액션은 자동으로 보호된다고 설명합니다.
운영 환경에서는 어떤 로그인 옵션이 있나요?
매직 링크, 이메일과 비밀번호 대체 수단, Google과 GitHub 소셜 로그인을 언급합니다.
상세 정보
작성자의 원본 설명
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
인기도
- GitHub 스타
- 7.6k
- 순위
- #13137
- 라이선스
- MIT
- 업데이트
- 2026. 11. 2.
댓글
- …
이 저장소의 다른 스킬
design-exploration
7.6k에이전트가 여러 UI 디자인 방향을 나란히 보여 주고, 사용자가 하나를 고르면 그 디자인을 다듬도록 돕습니다.
visual-edit
7.6k에이전트가 실행 중인 로컬 앱을 시각 편집기에 열어, 실제 화면을 함께 검토하고 편집하도록 돕습니다.
turn-into-app
7.6k워크플로, 스프레드시트 또는 프로젝트를 데이터가 채워진 세련된 시각 앱으로 바꾸고, 컨트롤 뒤에서 에이전트가 작업하도록 합니다.
visual-plan
7.6k일반 텍스트 계획을 다이어그램, 파일 맵, 코드 조각, 열린 질문이 담긴 대화형 시각 계획으로 바꿔 줍니다.
비슷한 스킬
api-connector-builder
280k에이전트가 기존 패턴을 따라 새로운 API 연결을 만들도록 합니다. 새로운 방식을 도입하지 않고 연동을 하나 더 추가할 때 씁니다.
api-design
280k에이전트가 모범 사례에 따라 REST API를 설계하도록 돕습니다. API가 통신하는 방식, 오류를 보여 주는 방식, 데이터를 정리하는 방식을 정하는 데 유용합니다.
backend-patterns
280k에이전트가 서버 쪽 아키텍처 패턴과 데이터베이스 최적화를 다루도록 돕습니다. 서버에서 실행되는 코드를 만들거나 검토할 때 유용합니다.