Info
- How sign-in works inside Service Hub. The user side, step by step: Signing In (Manual)
- Browsers (the console) sign in with a cookie
- Apps and game servers sign in through the API and get a JWT access token
- Every signed-in browser or device is a session. Users see and end them on their Profile
Sign-in methods
- Console
- Email + password at
/login, accounts from /register. With mail set up, a new password account confirms its email before it can sign in with the password. Accounts whose email is never confirmed are deleted after 7 days, unless they signed in or have a linked login (e.g. a guest linked with a password)
- The sign-up form turns bots away: an I'm not a robot check the browser solves by itself (ALTCHA, no third party), a hidden field and a minimum time on the form. Bots get the usual answer, but no account
- Two-factor sign-in with an authenticator app: turned on in Profile, asked after the password at
/login/two-factor, with one-time recovery codes. Service Hub → Settings can require it for admins, who then set it up before using the console or the admin tools. An admin turns it off for someone who lost both the app and the codes
- Group invite links (
/join/…) ask to log in or create an account first, see Groups
- Google and GitHub, when their keys are set and only on the main domain (see Deployment). Only emails the provider has verified are used
- Apps
- Email + password -
POST /api/v2/auth/password, new accounts from POST /api/v2/auth/register
- Device code - the app calls
POST /api/v2/auth/device-codes and shows an 8-letter code and the /activate address (also as a link with the code filled in, for a QR). A signed-in user enters the code at /activate or Profile → Sign in a device and approves or denies it. The app polls POST /api/v2/auth/device-codes/token every 5 s, faster gets slow_down. A code lives 10 minutes and works only for its own app: polled from another app it answers expired_token
- Guest -
POST /api/v2/auth/guest, no account needed. Without guest_key the hub makes a new guest and answers its key (shg_…) once; the app keeps it and sends it next time. Only the hub makes keys, so nobody opens a guest by guessing a weak key an app picked
- Apps can turn guests off in App Settings › Sign-in › Guests (
403 guests_off). Guests get only the Member role; the app's default roles come once they add an email
- Game servers
- Server ID + secret from the Servers page -
POST /api/v2/auth/server
- A linked machine's token -
POST /api/v2/auth/machine
- A player who hosts a server gets a server token for that hosting
- Admin tools
- The tools in Service Hub → Tools (GlitchTip, Grafana and others) sign in with the hub account through OpenID Connect. Admins and the groups and people picked for a tool get through
- Apps sign in with the password alone; two-factor sign-in covers the website and the admin tools

Sign in a device
Sessions
- Browser sessions last 14 days and extend while used
- App tokens
- How long a sign-in lasts after its last use: accounts as the app's Settings say (Stay signed in: 7, 30, 60 or 90 days, 1 year or Never), else the default in Service Hub → Settings (60 days unless changed). Guests 30 days and game servers 1 day, since they sign in again by themselves
- Every app sign-in gets a 1 h access token and a refresh token for that window, sliding on every refresh. A changed setting applies at the next refresh
- Refreshing twice with the same token, also at once, gives the same new token. The old one works for a minute, reusing it later ends the session
POST /api/v2/auth/logout ends the app's session on the server
- A browser or app install that signs in again replaces its earlier session
- Changing your own password on the Profile ends every other session, apps included, while Sign out other devices is ticked (the default). Unticked, apps stay signed in and other browsers sign out within about 30 minutes. A password reset by email or on the Users page, and a global role change, end all of the account's sessions
- Profile → Signed-in devices lists sessions with app, method, last activity and IP with its country
- Ended sessions are deleted with their IP 30 days after they end, admin tool sign-ins 14 days after
- A signed-out device gets
401 session_ended on its next call and signed_out on its events connection within a minute, an open console tab logs out within a minute
- Endpoints: Auth API
Tokens
- App access tokens are JWTs signed with
JWT_KEY
- A player's or guest's:
sub (the user id), session_id, app_id and kind (player or guest). A sign-in approved on the website (device code) also carries the person's hub staff roles. No email, app secret or app roles: the hub reads app roles on each call
- A server's:
sub (the server's database id), server_id, app_id and kind: server (server ID + secret), machine (a linked machine, with machine_id) or player_host (a player hosting, with hosting_id)
- A server token stops working when its server is turned off, deleted or gets a new secret, its machine is unlinked or its hosting ends
- A refused token answers
401 with why: token_expired, session_ended, server_token_revoked or unauthorized, see API