Authentication Flow Implementation Planner
Plan sign-up, sign-in, recovery, session, and authorization behavior for an AI-built app before authentication code is generated.
Vibe coders adding authentication who need a complete flow and authorization plan instead of a copied login snippet.
You are an application security engineer who specializes in practical authentication and session flows for small web applications.
Inputs:
1. App, users, and protected actions: {{app_context}}
2. Authentication provider and technology stack: {{auth_stack}}
3. Required sign-up, sign-in, recovery, and account flows: {{required_flows}}
4. Roles, permissions, and sensitive data: {{access_context}}
5. Security, privacy, UX, and deployment constraints: {{constraints}}
Do the following:
1. Map every authentication state, including anonymous, pending verification, authenticated, expired, locked, recovery pending, and signed out, plus the transitions between them.
2. Separate authentication from authorization and define server-side enforcement for every protected resource and action rather than relying on hidden interface elements.
3. Specify session storage, expiration, refresh, logout, device handling, redirect safety, error behavior, rate limits, and account-recovery safeguards using the provider's supported patterns.
4. Define user-facing screens and messages for success, invalid credentials, duplicate accounts, expired links, provider outages, and inaccessible email without exposing account existence unnecessarily.
5. Produce an implementation sequence, route and middleware matrix, state diagram in text, test cases, environment-variable checklist, and security review points. Flag provider-specific details that must be verified against current documentation.How to use
- List protected resources and actions, not only user roles.
- Name the actual authentication provider and framework.
- Include invitation, recovery, and session-expiry requirements.
- Verify provider-specific implementation details before coding.
Example input
App: Private family document vault. Stack: Remix, TypeScript, PostgreSQL, and Clerk. Flows: invitation-only account creation, email sign-in, passwordless recovery, sign out all devices, and invitation expiration. Roles: vault owner and member; only owners can invite or permanently delete files. Constraints: EU hosting, no social login, sessions expire after 12 hours of inactivity, deleted-account emails must not reveal stored filenames.
Example output
The plan defines invitation, verification, active-session, expired-session, revoked-member, and recovery states. Clerk confirms identity, while server loaders and actions enforce vault membership and owner permissions for every resource. It includes safe redirects, generic recovery responses, invitation expiry, all-device revocation, 12-hour idle behavior, and tests for cross-vault access, revoked sessions, expired links, and hidden owner-only controls backed by server denial.
Customization tips
- — Use server-side authorization for every write.
- — Add abuse and cross-account access tests.
- — Define what happens when email access is lost.
- — Keep secrets and callback URLs environment-specific.
Tags
FAQ
What is this prompt for?
How should I customize it?
Are there any limitations?
How is it different from a basic prompt?
Related Prompts
All Vibe Coding prompts →AI-Generated Code Change Reviewer
Review an AI-generated patch against the requested behavior, repository conventions, security boundaries, and regression risks before accepting it.
Database Migration Change Planner
Plan a schema or data change for an AI-built app with compatibility, backfill, validation, rollback, and deployment sequencing.
AI Coding Context Pack Builder
Create a compact, reliable context pack that helps an AI coding assistant understand an existing app before making changes.
Related Skills
Secure Authentication Flow Reviewer
Review authentication and session flows for account security, token handling, authorization boundaries, recovery, abuse, and operational controls.
API Integration Scaffold Generator
Generates a working code scaffold — auth, request wrapper, error handling, and rate-limit retry logic — for integrating any REST API.
Related Articles
How do I use AI tools like Lovable or Cursor to build an app?
AI app builders work best when users provide a scoped feature request, data model, user flow, UI constraints, acceptance criteria, and test cases.
What is vibe coding, and where does it break?
Vibe coding can help users prototype quickly with natural language, but it breaks when requirements, security, data model, testing, and maintainability are ignored.
How to Plan a Vibe-Coded App Before Building
Learn how to plan a vibe-coded app before asking AI builders like Lovable, Bolt, Replit, Cursor, Codex, or Claude Code to generate it.