Authentication

Connect login to your data

Users sign in with email, OAuth or as guests, and Postgres, functions and storage all see the same user ID.

volcano.dev/dashboard/your-users
The Your Users page in the Volcano dashboard: user metrics, sign-in charts and the list of users

What it does

Keep each user’s data behind a login

One user ID reaches every policy and handler, so each rule checks the same person.

  • Sign-in

    Email, Google, GitHub, Microsoft, Apple and guests.

  • Identity

    Postgres policies and function handlers get the same user ID.

  • Sessions

    List sessions and sign out other devices.

What you need

  • A Volcano account

    Auth is built in.

  • Volcano CLI

    Deploys your auth settings.

  • A Postgres table

    For policies that use the user ID.

Try it

Three steps from zero.

  1. Sign users in

    Sign-in works right away, or after email confirmation if you turn it on.

    Client

    TypeScript
    const volcano = new VolcanoAuth({ apiUrl, anonKey }); const { confirmationRequired } = await volcano.auth.signUp({ email, password }); if (!confirmationRequired) await volcano.auth.signIn({ email, password }); volcano.auth.signInWithGoogle();
  2. Protect rows with a policy

    auth.uid() is the signed-in user's ID.

    Policy

    SQL
    alter table documents enable row level security; create policy documents_owner_read on documents for select to authenticated using (owner_id = auth.uid());
  3. Read the user in a function

    Calls made with only the anon key have no user.

    Function

    JavaScript
    exports.handler = async (event) => { const auth = event.__volcano_auth; if (!auth) return { statusCode: 401 }; return { statusCode: 200, body: JSON.stringify({ user_id: auth.user_id }) }; };

Check it works

  • Sign in as two different users. Each sees only their own rows.
  • Call the function signed out. It returns 401.
  • Sign out another device from the sessions list. That device’s session ends.

Works with

Questions

What login methods does Volcano support?

Email and password, Google, GitHub, Microsoft and Apple OAuth, and guest sessions. Magic links, SMS, passkeys, TOTP and SAML aren’t supported.

How do I add authentication to a Next.js app?

Sign users in with @volcano.dev/sdk. In middleware, call withAuth and redirect to your login page when it returns no user.

How does authentication work with Postgres row-level security?

Policies call auth.uid() to get the signed-in user. Compare it to each row’s user_id. Keep the service key on the server, since it bypasses RLS.

More answers in the docs

It will blow your mind!

Pun intended. Build, deploy & scale on the Volcano platform for free.

Start building