Vibe Code Forum teamAdmin
The moment your app has users, you need authentication (who is this?) and authorisation (what are they allowed to do?). Getting these wrong is the most common way vibe-coded apps leak data.
Rule one: don't build it yourself
Writing your own password storage and login system is where serious mistakes happen. Use a proven service or library:
- Built into your back end service: Supabase Auth, Firebase Authentication.
- Dedicated services: Clerk, Auth0 and similar, with ready-made sign-in screens.
- Libraries in your framework: for example Auth.js or Better Auth for JavaScript apps.
AI tools know these well. Ask: "Add sign-in with email and Google using [service], and explain each step."
How sign-in works, roughly
- The user proves who they are: password, a magic link sent by email, a one-time code, or "Sign in with Google".
- The service gives the browser a session (usually a cookie or a token).
- Every later request carries that session, and your back end checks it before doing anything.
Authorisation: the part that leaks
Being signed in isn't permission to do everything. For every action, the server must check the user is allowed:
- Can they only read their own notes, orders, messages?
- Are admin-only actions checked on the server, not just hidden in the menu?
- If the request says
user_id=42, does the server use the signed-in user's id instead of trusting the number sent?
With Supabase or Firebase, these checks live in Row Level Security policies or Security Rules. See Supabase and Firebase.
Test it yourself
Create two test accounts. Sign in as the first, copy the address of one of its private pages, sign in as the second and open that address. You should be refused. Ask your AI tool to write automated tests for the same check.
Small things that matter
- Email verification before letting new accounts do much.
- A working "forgot password" flow (try it).
- Rate limits on sign-in attempts (most services include this).
- Let people delete their account and data; in many countries you have to.
Read next: Databases for beginners: tables, rows and why you need one and Supabase and Firebase: a database without your own server.