Expand description
Signing in to this server: its own accounts (a username and a
password), and, with ESPORTS_LOGIN, “Sign in with the host site”
(esports-lab). Both end in this server’s session cookie, which the OAuth
consent page and the Account page (API tokens) use.
The host site. It shares a secret with this server
(ESPORTS_SECRET) and uses it two ways:
- Signing in:
GET /auth/esportssends the browser to the site’s/chess/sso?return=…&nonce=…; the site sends it back to/auth/esports/back?a=…with a signed statement of who is signed in there (sign:base64url(json).base64url(HMAC-SHA256), the JSON{sub, name, email, role, roles, nonce, exp}). - Its server asks for a token for one of its players:
POST /api/esports/tokenwithAuthorization: Bearer <secret>and the same fields as a form (plusscopes,days,label).
Either way the site’s player is linked to a player here by esports_id
(made on first use, with a chess account named after them), so the
same person is the same chess player whichever way they come in.
Structs§
- NewAccount
- SignIn
- SignUp
- Site
Player - A player of the host site, as it describes them.
Functions§
- account
GET /account.- account_
passkey_ add POST /account/passkeys: the new passkey.- account_
passkey_ options POST /account/passkeys/options: a challenge to add a passkey.- account_
passkey_ remove POST /account/passkeys/remove(formid). The last passkey of an account without a password stays.- account_
password POST /account/password(formpassword, andcurrent: the password it replaces, unless a passkey confirmed it’s you): set or change it.- account_
password_ remove POST /account/password/remove: passkeys only (with one, at least).- account_
staff POST /account/staff: the passkey check, for this session.- account_
staff_ options POST /account/staff/options.- allowed
- The scopes a player may give a token (staff-only ones aside).
- api_
staff POST /api/account/passkey: the passkey check, for the token used.- api_
staff_ options POST /api/account/passkey/options(a token): a challenge for the staff passkey check, made in an app.- esports_
back GET /auth/esports/back?a=…: back from the site, signed in there.- esports_
link POST /api/esports/link(bearer the secret; formsub,username): a manager on the site says the accountusernamehere is their playersub’s, made before they signed in with the site. The site player’s link moves to it (an account it was linked to before stays, unlinked, with its games). Refused (409) when that account is another site player’s. An emptyusernameunlinks. Answers{"username"}.- esports_
players GET /api/esports/players(bearer the secret): the site’s players linked here,{"players": [{"sub", "username"}]}, so the site can tell whose games the feed shows.- esports_
revoke POST /api/esports/revoke(bearer the secret; formlabel, and optionallysub): revoke the tokens of that name the site asked for (all its players’, or one’s). Answers how many.- esports_
start GET /auth/esports: off to the site to sign in.- esports_
token POST /api/esports/token: the site’s server asks for a token for one of its players (who gets linked, and a chess account, on first use).- grant_
listed CHESS_ADMIN_EMAILS: this player becomes an admin if their confirmed email is listed and they have a passkey (an admin’s rights need one). Their email is as good as the host site’s sign-in that vouched for it.- hmac
- HMAC-SHA256 (RFC 2104).
- issue
- Make a token; returns it (shown once) and when it expires.
- issue_
for - Make a token lasting
life. - link
- The player here linked to the site’s, made on first use (and kept up to date: the email, which the site vouches for). The site’s roles stay the site’s: roles here are this server’s own. Returns the player’s id and chess username.
- login
POST /login: a username (or email) and password.- login_
page GET /login.- logout
POST /logout.- new_
token POST /account/tokens.- passkey_
signin POST /auth/passkey: signed in with a passkey (which is also the staff passkey check). Answers where to go next.- passkey_
signin_ options POST /auth/passkey/options: a challenge to sign in with any of this server’s passkeys.- revoke_
token POST /account/tokens/revoke.- sign
- A signed statement:
base64url(json).base64url(hmac). - signup
POST /signup: a username, a password and (optionally) an email.- signup_
page GET /signup.- signup_
passkey POST /signup/passkey: the new account, with its passkey, signed in.- signup_
passkey_ options POST /signup/passkey/options({name, email}): a challenge to make an account with a passkey instead of a password.- verify
- The statement, if its signature is right and it hasn’t expired.