Add login & user accounts

Your app will have sign-up and login pages so each person gets their own private space and data.

Why you need accounts

Right now, everyone who visits your app sees the same thing. If you're building a to-do list, a journal, or anything where people should have their own private information, you need user accounts. Once someone logs in, the app knows who they are and can show them only their own tasks, posts, or whatever you're building.

Meet Emergent Auth

Emergent Auth is the platform's built-in authentication. It supports:

  • Email and password: the traditional way. Users pick a password and the app stores it securely (hashed, never in plain text). Works out of the box with zero setup.
  • Google sign-in: no keys needed, no Google Cloud Console setup. (Optionally, supply your own GOOGLE_CLIENT_ID/GOOGLE_CLIENT_SECRET env vars if you need custom consent-screen branding or extra scopes like Gmail or Calendar access.)

It works in both preview and production, sessions carry across publishing, and there are no API keys to configure.

Added on request

Authentication is added to your Emergent app by asking the agent, it is not shipped by default. You just describe what you want in chat and the AI wires it up, with no extra billing required.

Add login with a prompt

Tell the AI what you want in plain English:

Describe sign-up and login

Type something like: "Users should be able to sign up with email and password, then log in to see their dashboard."

The AI will create login and sign-up pages, handle sessions, and make sure people stay logged in when they come back.

Protect your pages

If you only want logged-in people to see certain pages, say: "Make the dashboard page require login."

Visitors who aren't signed in will be sent to the login page first.

When to use something else

Emergent Auth is optional. If you need full control over the login experience, a completely custom UI, or auth that lives with a provider you already use, you can integrate Auth0, Clerk, Firebase Auth, or Supabase Auth instead, and your users go through your chosen provider's flow. See Connect your tools.

See your users

Once people start signing up, their accounts are stored in your app's database.

Accounts live in a collection, for e.g., it might be called 'User'. You can ask the AI to show you a list: "Show me all registered users in an admin page." Each user record includes their email, when they signed up, and any extra fields you've added (like display name or profile picture).

If something looks wrong

People can't log in after signing up - make sure you tested the sign-up flow yourself in preview and production modes.

You want to add profile pictures or other fields - just describe it: "Add a displayName field to users so they can choose a nickname." The AI will extend the user records and update the sign-up form. Make sure to do this before you publish for the first time because your database schema is set the first time you publish.

Sessions expire too fast - Emergent Auth keeps people signed in using secure, server-side sessions. If the timeout doesn't suit your app, just describe what you want in chat: "Keep users logged in longer between visits."

Go deeper: Emergent Auth