Skip to content

How login works

6umi.net has two ways of telling who "someone" is: an anonymous per-device ID, and logging in with a Google account. Logging in is optional; you can read and post without it.

What kind of auth is it, in short

OpenID Connect (OIDC) authentication with a Google account is handed off to Firebase Authentication, and the site's own login state is kept in a Firebase session cookie (a signed JWT). 6umi.net itself holds no passwords and is not an ID provider.

  • Firebase Authentication: the authentication piece of Google's backend service (BaaS). It handles the exchanges with providers such as Google, Apple and email, and assigns each signed-in person a uid (the user ID inside Firebase). 6umi.net enables only the Google provider
  • ID token: a JWT held by the Firebase SDK in the browser right after sign-in. Valid for 1 hour, signed by Google. It contains the uid, email, issue time and so on
  • session cookie: a JWT that the server-side Firebase Admin SDK creates in exchange for the ID token. Its lifetime is set anywhere from 5 minutes to 14 days (6umi.net uses 14 days). Verifying it only means checking the signature against Google's public keys, so both the API and the boards can extract the uid without asking Firebase. Revocation is not checked
  • What stays in the browser: two things, the Firebase SDK's own sign-in state (IndexedDB) and the __session cookie. The former is used for the nav display, the latter for authenticating to the server. Sign out clears both

The two identifiers

cookie Issued Lifetime Used for
Anonymous ID (cid) cid A UUID the browser creates itself when you open a board 2 years Post ownership, UI settings
Login __session Issued by the API after you sign in with Google 14 days Same as above, across devices

Both cookies apply to all of .6umi.net. So whether seen from 6umi.net (the portal), sw.6umi.net (the board entrance) or the API, you look like the same person.

The login flow

sequenceDiagram
  participant B as ブラウザ
  participant P as 6umi.net/login
  participant F as Firebase Auth(Google)
  participant A as API
  B->>P: sign in with google
  P->>F: ポップアップでサインイン
  F-->>P: idToken
  P->>A: POST /v1/auth/session(idToken)
  A->>F: idToken を検証し、session cookie を作る
  A-->>B: Set-Cookie __session(.6umi.net / HttpOnly / Secure / 14 日)
  B->>B: sw.6umi.net へ
  • Authentication itself is left to Firebase Auth. No passwords are stored. Google is the only provider, and there is no registration step (the uid is created on first sign-in)
  • The portal just passes the idToken to the API. The API exchanges it for a Firebase session cookie and returns it as __session
  • __session is HttpOnly, so page JS can't read it. The browser sends it, and only the server side reads it

From the board's side

The board (Streamlit) is embedded in an iframe on the sw.6umi.net page. Even inside an iframe it's the same site (.6umi.net), so the browser sends both cid and __session to the board.

  • The board verifies the __session signature with Firebase's keys and extracts the uid. A cookie that fails verification is treated as absent (forging one just makes you anonymous)
  • Posts are sent to the API with both client_id (cid) and user_uid (uid; empty if not logged in)
  • If someone arrives at the board directly without a cid, they're sent back to sw.6umi.net, where the entrance creates a cid and they come back in through the iframe

The kuzuha-style UI (SPA) works the same way. The browser attaches the cookies automatically, and the API verifies the signature and attaches the uid. Without one, the post is anonymous.

What logging in changes

Whether two requests are the same person is decided by "uid matches" or "cid matches." Logging in adds the uid.

  • The ownership check when "flushing" (deleting) posts or uploads works across devices. You can flush your own posts from another device or browser
  • UI settings are saved by uid first. If there are no uid settings, the cid settings are read. Even if cookies are cleared, the uid-side settings remain

Signing out

Sign out on the account page signs you out of Firebase and sends DELETE /v1/auth/session to the API to clear __session. cid stays, so you go back to being identified only by this device's cookie. Logging in again restores everything.

What's shown on screen

The icon in the top nav (login / account) switches based on Firebase's auth state. Settling that takes a few hundred ms, so the previous state is remembered in localStorage, drawn first, and then adjusted to the real state.

Created 2026-10-13 · Machine-translated from the Japanese original.