Skip to content
runlot
DataAuth

Auth

Let your app's users sign up, and check whether they are signed in. The user table lives in your project database, and default login and sign-up screens are included.

Every project has auth. You get the following.

  1. env.auth, for use inside your worker
  2. Login and sign-up screens served from your app at /__runlot/auth/*, from the first time your worker calls env.auth — until then those paths are your app's like any other
const user = await env.auth.user(request);
if (!user) return Response.redirect("/__runlot/auth/sign-in");

Auth is not access control

FeatureWhat it doesWho it applies to
Auth (this page)Identifies your app's users through env.authYour app's users
Access controlLimits who can reach the deployment itselfYour team, anyone who knows the password, or every visitor

For example, showing a pre-launch deployment only to members of your organization is access control. Identifying which user is logged in to the app inside that deployment is auth. The two are independent of each other.

The user table lives in your project database

User records are stored in the runlot_auth schema of your project database. You can query them with psql or join them against your own tables.

select id, email, created_at from runlot_auth.users order by created_at desc limit 20;

Passwords and session tokens are stored only as hashes.

A custom login page can ask which methods are on with config() from @runlot/auth/client (details).

In this section

Getting started

Operating

Reference

On this page