AI Build South Africa
A fundamentals guide, written for someone whose AI builder wires up login through a prompt, not someone implementing a password system from scratch.

Quick answer

Authentication is the process of proving who you are, most commonly by entering a password that matches what's stored for your account. It's a different question from authorization, which is what you're allowed to do once you're recognised. Once you're authenticated, your app has to remember it for every request that follows, using either a session (the server keeping track, tied to a cookie in your browser) or a token (a signed piece of data your app can verify without a lookup, most commonly a JWT). Lovable and Bolt.new both use Supabase Auth by default; Base44 ships its own built-in authentication. Different mechanics, same underlying job: recognising you without asking for your password on every single request.

The one-sentence version: proving who you are, not what you're allowed to do

Authentication answers exactly one question: is this really you? A password matching what's on file, a code from an email link, a passkey on your device, all prove identity the same underlying way, by checking something only the real account holder could produce. What happens after that, whether you can see another user's data or reach an admin page, is a separate question entirely, called authorization, and it's genuinely common for a system to get one right and the other wrong.

Authentication vs. authorization

Authentication

Proves identity:

"Is this really you?" Checked once, at login

Authorization

Decides permission:

"What are you allowed to see or do?" Checked on every relevant request

AI Build · aibuild.co.za

Two ways your app remembers you're logged in: sessions and tokens

Once you've authenticated, your app needs a way to recognise you again on every following request, without asking for your password each time. A session is the older, still-common approach: the server keeps a record of who's logged in, tied to a unique ID stored in your browser's cookie, and checks that record on each request. A token, most often a JWT, works differently: it's a signed piece of data containing your identity that your app can verify on its own, without a server-side lookup, which is why it scales more easily across separate services. Neither is universally "better," they're different tools for the same job, and which one you're using is usually decided by your platform's own authentication provider, not something you choose directly.

Where this actually happens on your AI-built app

Lovable and Bolt.new both use Supabase Auth by default, which issues a short-lived JWT access token, typically valid for 5 minutes to an hour, plus a longer-lived refresh token used to silently get a new one once it expires, so you stay logged in without re-entering a password constantly. Base44 ships authentication as a built-in backend feature the same way it ships its database and storage, no separate service to connect. Either way, your AI agent wires this up by prompting for it, connecting sign-up, login and "who's currently logged in" checks to your app's own pages, not by writing password-handling code from first principles.

The one rule that matters again here: never trust the frontend to decide who's authenticated

The same rule this site's guide to why you can't put an API key in the frontend covers applies directly to authentication too: a frontend check like "hide this button if not logged in" is a display decision, not a real security boundary, since a visitor's own browser fully controls what runs there. The actual enforcement has to happen on the backend, and for data specifically, this is exactly what this site's guide to what a database is covers under Row Level Security: a database rule, not a frontend check, deciding which rows a given authenticated user is actually allowed to see.

Not every login needs to be built from scratch

Social login, signing in with an existing Google account instead of creating a new password, and passkeys, device-based authentication with no password involved at all, are both increasingly common alternatives worth considering before defaulting to a traditional email-and-password form. Most platforms this site documents support at least social login as a real, tested option your AI agent can wire up the same way it handles password-based login, not a separate, harder feature to add later.

Where to go next

Not affiliated with the platforms we write about

AI Build South Africa is an independent resource. We're not endorsed by, or an official partner of, PayFast, Yoco, Peach Payments, Ozow, Meta, Lovable, Base44, Bolt.new or Anthropic. We do participate in affiliate and referral programmes with some of these providers, including Base44. See our Disclaimer for the full disclosure and our Terms of Service for the wider terms.

Frequently asked questions

What's the difference between authentication and authorization?

Authentication proves who you are: logging in with a password confirms your identity. Authorization decides what you're allowed to do once that's established: whether you can view another user's order, edit a setting, or access an admin page. A system can authenticate someone correctly and still get authorization wrong, letting a genuinely logged-in user reach something they shouldn't. They're two separate checks, not one.

What is a session, in plain terms?

A session is your app's server remembering that you're logged in, tied to a unique ID it gave your browser (usually stored in a cookie) at the moment you signed in. Every request after that includes the cookie, so the server can recognise you without asking for your password again. The server, not just your browser, keeps track of who's actually logged in.

What is a token, and how is it different from a session?

A token, most commonly a JWT (JSON Web Token), is a signed piece of data proving who you are that your app can check without looking anything up on the server each time, unlike a traditional session. Supabase Auth, which Lovable and Bolt.new both use by default, issues a short-lived access token (typically 5 minutes to an hour) plus a longer-lived refresh token used to get a new one once it expires.

Do I have to build my own login system?

No, and doing so from scratch is rarely the right call even if you could. Lovable and Bolt.new both use Supabase Auth by default, which handles password hashing, session and token management, and social login out of the box. Base44 ships authentication as a built-in backend feature the same way. Your AI agent wires these up through prompts, not by writing a password system from first principles.

Is a password the only way to authenticate someone?

No. Social login (signing in with an existing Google or similar account instead of creating a new password) and passkeys (device-based authentication with no password at all) are both increasingly common alternatives, and most platforms this site documents support at least social login as an option alongside a traditional password.

Why does "staying logged in" sometimes break after a deploy?

Most often the same underlying cause as other deploy-only failures this site documents: an environment variable or configuration value your authentication provider needs wasn't carried over correctly from preview to the deployed environment. Worth checking the same two places this site's own guide to deployment covers before assuming the authentication logic itself is broken.

Related reading