First sign-in on a new install
A new install has no SMTP config and no OAuth app, and hopbox has no passwords. So the first instance admin signs in through a one-time login link that root prints on a control server. This guide signs in that way on a laptop. Then it reads the account and the audit log, and sets up magic links for everyone else.
This guide calls the API with curl, in the same way as the console does, so it shows each call. Use the console signs in with the same link in a browser.
What you need
Section titled “What you need”hopboxdwith the control role on a laptop, as in Run the control role on a laptop. This guide uses its bootstrap config/tmp/hb/hopboxd.tomland the API on127.0.0.1:7080.- curl.
- For magic links: an SMTP server. A local mail catcher such as Mailpit works, on
127.0.0.1:1025. Without one, use the file mail transport, as in Magic links without an SMTP server.
Start hopboxd, and leave it running:
./bin/darwin_arm64/hopboxd run --config /tmp/hb/hopboxd.tomlIn a second terminal, define a short name for the admin command:
admin() { ./bin/darwin_arm64/hopboxd admin --config /tmp/hb/hopboxd.toml "$@"; }On a server, the same commands run as root: sudo hopboxd admin ....
Set the domain
Section titled “Set the domain”A link points at the domain of the install, so the install needs one first:
admin config set --domain example.comdomain example.compublic_addresses -acme_directory_url https://acme-v02.api.letsencrypt.org/directoryacme_email -acme_terms_agreed falsemail_transport smtpversion 2update_time 2026-10-16T09:09:15ZWithout a domain, login-link fails with failed_precondition.
Print the login link
Section titled “Print the login link”admin login-link --email root@example.orghttps://example.com/auth/login-link#token=tOzJ8YQyibHutrU34tIWLHnGd5XlzYs4WoIBXgSDh5IThe link signs in root@example.org once, until 2026-10-16T09:24:15Z.The link works once, for 15 minutes. Treat it as a password until then. The audit log records that root made it, but never the token (Sessions, cookies, and sign-in links).
On an install with an edge, you open this link in a browser (Use the console). The console page reads the token after #token= and calls VerifyLoginLink. Here, you make that call yourself.
Sign in with the link
Section titled “Sign in with the link”Put the token in a shell variable, and call VerifyLoginLink:
TOKEN=tOzJ8YQyibHutrU34tIWLHnGd5XlzYs4WoIBXgSDh5Icurl -s -D /tmp/hb/headers -X POST -H 'Content-Type: application/json' \ -H 'Connect-Protocol-Version: 1' -H 'Origin: https://example.com' \ -d "{\"token\":\"$TOKEN\"}" \ http://127.0.0.1:7080/hopbox.v1.AuthService/VerifyLoginLink{"account":{"id":"01a143f9-1cee-7ec0-9238-7976abaacfd6", "emails":[{"email":"root@example.org"}], "instanceAdmin":true, "personalOrgId":"01a143f9-1cee-7ec1-a648-71fea47ae54f", "version":"1", "createTime":"2026-10-16T09:09:21.774252Z"}, "newAccount":true, "sessionExpireTime":"2026-11-15T09:09:21.774252Z"}The link created your account, made it an instance admin, and gave it a personal org. Your email stays unverified. So a later magic link or GitHub sign-in with the same email reaches another account (Sessions, cookies, and sign-in links). To sign in to this account with a magic link, link your email from the session (Link your email to your account).
The two headers Origin and Connect-Protocol-Version are what the console sends. Without them, the call fails with permission_denied, so no page of another site can sign a browser in. Try the link a second time, and it fails with unauthenticated: it works once.
The response sets the session cookie. The cookie has the Secure flag, so curl does not send it back over plain HTTP. Copy it from the saved headers:
COOKIE=$(sed -n 's/^Set-Cookie: \(__Host-hopbox_session=[^;]*\).*/\1/p' /tmp/hb/headers)browser() { curl -s -X POST -H 'Content-Type: application/json' -H 'Connect-Protocol-Version: 1' \ -H 'Origin: https://example.com' -H "Cookie: $COOKIE" "$@"}The session lasts 30 days. After 7 days without a call, it ends before that (Sessions, cookies, and sign-in links).
Read your account
Section titled “Read your account”browser -d '{}' http://127.0.0.1:7080/hopbox.v1.AccountService/GetAccount{"account":{"id":"01a143f9-1cee-7ec0-9238-7976abaacfd6", "emails":[{"email":"root@example.org"}], "instanceAdmin":true, "personalOrgId":"01a143f9-1cee-7ec1-a648-71fea47ae54f", "version":"1", "createTime":"2026-10-16T09:09:21.774252Z"}}The same call from another origin fails. A page that a machine serves, such as https://box1.example.com, is another origin too:
curl -s -X POST -H 'Content-Type: application/json' -H 'Connect-Protocol-Version: 1' \ -H 'Origin: https://evil.example' -H "Cookie: $COOKIE" -d '{}' \ http://127.0.0.1:7080/hopbox.v1.AccountService/GetAccount{"code":"unauthenticated","message":"the credential is not valid"}Read the audit log of the install
Section titled “Read the audit log of the install”An instance admin reads the audit log of the whole install. With a session, the sign-in must be at most 10 minutes old (Sessions, cookies, and sign-in links):
browser -d '{"wholeInstall":true}' http://127.0.0.1:7080/hopbox.v1.AuditService/ListAuditEntriesThe newest entries come first: instance_admin.grant, auth.sign_in, and account.create by your session, then login_link.create and install_config.update by local_root (the sign-in, account, and audit API).
Turn on magic links
Section titled “Turn on magic links”Magic links let everyone else sign up and sign in by email. They need an SMTP config (SMTP config). A password needs a key-encryption key to seal it, so make the first one now:
admin kek rotatefile:1For a local mail catcher without TLS and without a login:
admin config smtp set --host 127.0.0.1 --port 1025 --tls none --from 'hopbox <no-reply@example.org>'For a real SMTP server, pass the password on standard input, so it never shows in the process list:
printf '%s\n' "$SMTP_PASSWORD" | admin config smtp set \ --host smtp.example.org --username hopbox@example.org --password-stdin \ --from 'hopbox <no-reply@example.org>'The install now lists the email link as a sign-in method:
curl -s --http2-prior-knowledge \ 'http://127.0.0.1:7080/hopbox.v1.InstallService/GetInstallInfo?encoding=json&message=%7B%7D'{"domain":"example.com", "signInMethods":["SIGN_IN_METHOD_EMAIL_LINK"], "version":"v0.0.0-20261016090852-6a5e58e824e1"}Ask for a link:
curl -s -X POST -H 'Content-Type: application/json' -d '{"email":"ann@example.org"}' \ http://127.0.0.1:7080/hopbox.v1.AuthService/RequestMagicLink{}The email holds a link of the form https://example.com/auth/email#token=<token>. Sign in with its token as above, with VerifyMagicLink in place of VerifyLoginLink. The first sign-in creates the account of Ann and her personal org. In the default sign-up mode approval, the account is pending until an instance admin approves it (Use the Admin area). An email gets at most 5 links an hour (Sessions, cookies, and sign-in links). If the SMTP server fails, the call gets unavailable, and the log of hopboxd has the record the magic link email failed with the cause.
Magic links without an SMTP server
Section titled “Magic links without an SMTP server”A dev or test install often has no SMTP server. The file mail transport then writes each mail to a file on the server, and sends nothing (Mail). A production install uses SMTP, because with files no person gets a mail.
Turn on the file transport. It needs no SMTP config:
admin config set --mail-transport fileThe output has the line mail_transport file. hopboxd logs mail goes to files, not to recipients at level warn, and again with each mail.
Ask for a link, as above:
curl -s -X POST -H 'Content-Type: application/json' -d '{"email":"ann@example.org"}' \ http://127.0.0.1:7080/hopbox.v1.AuthService/RequestMagicLinkList the mail files of the server, newest first:
admin mail list20261016T091530.120044000Z-5cb912a8d0bb45d7.eml 2026-10-16T09:15:30Z <ann@example.org> Sign in to example.comPrint the newest file. The text has the link whole, on one line:
admin mail showname 20261016T091530.120044000Z-5cb912a8d0bb45d7.emlcreate_time 2026-10-16T09:15:30Zto <ann@example.org>subject Sign in to example.com
Open this link to sign in to example.com:
https://example.com/auth/email#token=Zm9vYmFyYmF6cXV4cXV1eGNvcmdlZ3JhdWx0Z2FycGx5
The link works once, for 15 minutes. If you did not ask for it, you can ignore this email.Sign in with its token as above, with VerifyMagicLink in place of VerifyLoginLink. On a server, run sudo hopboxd admin mail show on the control server that took the request. Only root on that server reads the files, which live in <data_dir>/mail with mode 0700.
When the install gets an SMTP server, set its config, then switch back:
admin config set --mail-transport smtpLink your email to your account
Section titled “Link your email to your account”The email of your login-link account is unverified, so it links no magic link. Link it from your session instead (Sessions, cookies, and sign-in links). The link needs a sign-in within the last 10 minutes. If your sign-in is older, the call fails with permission_denied. Then print a new login link, and sign in with it again as in Sign in with the link.
Ask for a link of your email, with the session cookie and "link":true. This example uses the file transport of Magic links without an SMTP server, so admin mail show prints the mail:
browser -d '{"email":"root@example.org","link":true}' \ http://127.0.0.1:7080/hopbox.v1.AuthService/RequestMagicLinkadmin mail showname 20261016T091842.551203000Z-0b2e6f8c1d3a4e57.emlcreate_time 2026-10-16T09:18:42Zto <root@example.org>subject Add your email to your account on example.com
Open this link to add root@example.org as a sign-in method of your account on example.com:
https://example.com/auth/email#token=cXV1eGNvcmdlZ3JhdWx0Z2FycGx5d2FsZG9mcmVkcGx1
Open it in the browser where you asked for it. The link works once, for 15 minutes. If you did not ask for it, you can ignore this email.Use the token with the same session cookie:
TOKEN=cXV1eGNvcmdlZ3JhdWx0Z2FycGx5d2FsZG9mcmVkcGx1browser -d "{\"token\":\"$TOKEN\"}" http://127.0.0.1:7080/hopbox.v1.AuthService/VerifyMagicLink{"account":{"id":"01a143f9-1cee-7ec0-9238-7976abaacfd6", "emails":[{"email":"root@example.org", "verified":true, "verifyTime":"2026-10-16T09:19:03.402871Z"}], "instanceAdmin":true, "personalOrgId":"01a143f9-1cee-7ec1-a648-71fea47ae54f", "version":"1", "createTime":"2026-10-16T09:09:21.774252Z"}, "linked":true}The response has linked and no Set-Cookie, so your session stays. Your account now has the email link as a sign-in method, and the email is verified. A magic link to root@example.org now signs in to this account. Without the session cookie, the call fails with permission_denied, and the link stays unused: only the session that asked for the link can use it.
Keep a second instance admin
Section titled “Keep a second instance admin”An install keeps at least one instance admin, so admin instance-admin revoke refuses the last one. Make a second admin first, for example the account of Ann, by her verified email:
admin instance-admin grant --email ann@example.orgadmin instance-admin list01a143f9-1cee-7ec0-9238-7976abaacfd6 root@example.org 2026-10-16T09:09:21Z01a14411-5a20-7d3e-9f0e-0c6c2b3e4a51 ann@example.org 2026-10-16T09:20:02ZRoot on a control server can always print a new login link, or grant the role again. So a lost session never locks the operator out.
Sign out
Section titled “Sign out”browser -d '{}' http://127.0.0.1:7080/hopbox.v1.AuthService/SignOutThe response clears the cookie, and the session ends. The next call with the old cookie runs as an anonymous caller, and a call that needs a credential gets unauthenticated.
To let people sign up and sign in with GitHub or Google, register an OAuth app at each provider, as in Sign in with GitHub and Google.