Authentication

Authentication is the process of establishing who a user is — verifying a password, a code, a passkey or a token from another identity provider. It answers the question of identity only. What that identity is then allowed to do is authorisation, which is a separate decision.

Authentication is not authorisation

Two words, often shortened to authn and authz, and confusing them is the source of a lot of broken access control. Authentication proves you are the account holder. Authorisation decides whether that account may read this particular record. An application that checks only the first will happily let a logged-in user fetch someone else's data by changing an ID in the URL.

How the session is actually kept

HTTP forgets you between requests, so after a successful login the server issues something the client sends back each time:

Where the token lives matters. localStorage is readable by any script on the page, so a single cross-site scripting flaw exposes it. An HttpOnly cookie is not readable from JavaScript but needs protection against cross-site request forgery. Both are used in production; neither is free.

The rules that hold up

Never store passwords, only hashes from a slow algorithm designed for it — bcrypt, scrypt or Argon2. Never enforce a rule only in the interface: hiding a button stops nobody, because the request can be made directly. Rate-limit login attempts. And treat a second factor as the highest-value addition you can make, since it defeats stolen and reused passwords almost entirely.

Managed providers such as Supabase Auth, Auth0 and Firebase Authentication exist because getting all of this right is genuinely hard. NorthernGo apps use the same approach: .register(), .login(), .getToken() and .logout() sit on top of a managed identity layer, and any app with login must also provide .deleteAccount() — a working account deletion path is required, since GDPR article 17 gives users a right to erasure.

Frequently asked questions

Is it safe to store a JWT in localStorage?

It is common but not the safest option. Any JavaScript running on the page can read localStorage, so a cross-site scripting vulnerability leaks the token. An HttpOnly cookie protects against that but requires CSRF protection instead. Short token lifetimes limit the damage either way.

Build it yourself

NorthernGo turns a plain-text description into a working web app with a database, login and a live URL. Local AI generation runs on your own GPU, is unlimited, and is free on every plan.

Start building free