Sign in with Google or GitHub

A second way into the same account: “Continue with Google / GitHub” beside the name and password, on cartopolis.org and in the app. The account stays a Cartopolis account with a Cartopolis name (anna@cartopolis.org). Google or GitHub only confirm who you are, and the account can have both, one, or a password as well. Drawn in the web UI's tokens (src/css/theme.css, dark half). Everything here is NEW unless marked TODAY.

1Signing in on cartopolis.org

The sign-in card every page without a session shows (elements/signin), with the two buttons on top. Below them, the name and password form as it is now.

cartopolis.org/buildings
Sign in

One account for the world and for this page.

Continue with Google
Continue with GitHub
or with your Cartopolis name
anna
••••••••
Sign in
New here? Sign up

What the buttons do

  • A plain redirect to Google's or GitHub's own sign-in page and back to /api/auth/google/callback. No Google or GitHub script is loaded on our pages.
  • We ask for the least there is: Google openid email profile, GitHub read:user user:email. That is a stable id, the e-mail address and a display name. We never post anywhere and never read repositories or contacts.
  • Only where the server offers them. The operator turns each on with a client id and secret (section 6). GET /api/register lists what is on, and a server with neither shows exactly today's card.
  • The same buttons on Sign up. Sign up and Sign in become one step for these, because the provider has already confirmed the address. No mail link to wait for.

After the round trip

  • Known Google/GitHub id → signed in, straight back to the page you came from.
  • Unknown id, new address → pick a name (section 2).
  • Unknown id, but the address already has an account → link it (section 3).

2First time: Google's page, then one question

Google asks which account to use and says what it will share. Back on cartopolis.org the only thing left to ask is your name here, because that is your address in chat, calls and the fediverse.

accounts.google.com/o/oauth2/…

Choose an account

to continue to Cartopolis

A
Anna de Vriesanna.devries@gmail.com
+
Use another account
Google's page, not ours: drawn only for the order of events
→
cartopolis.org/welcome
Welcome to Cartopolis
A
Anna de Vriesanna.devries@gmail.com · confirmed by Google
anna@cartopolis.org
Free. This is how people find you in chat and calls.
Create my account
That's not me — use another account

Choices made here

  • The name is suggested, not taken. We fill in the given name, lower-cased and checked against the same rules as /register, and the person can change it. It is permanent, so it is asked for, not derived from a Gmail address.
  • No password and no mail link. Google's email_verified, or GitHub's primary verified address, counts as confirmation, which is what the mail link exists for. A provider address that is not verified is not stored, and the account starts with none.
  • Registrations closed on this server? Then this card says so, as /register does today, and only already-linked accounts can sign in with Google.
  • Stored: provider, the provider's id for the person (never the address, which can change), and when it was linked. No provider tokens are kept after sign-in.

3The address already has an account: prove it once, then link

Someone who signed up with a password tries GitHub for the first time. We don't join the two on the e-mail address alone. The password is asked for once, and after that either way works.

cartopolis.org/welcome
You already have an account
annadv on GitHubanna@devries.nl · verified by GitHub

That address belongs to anna@cartopolis.org. Enter its password once to add GitHub to it, and you can then sign in either way.

••••••••••
Add GitHub and sign in
Forgot the password?

Why not link automatically

  • The account is worth more than the address. Linking on the address alone would let whoever controls that address at Google or GitHub take over an account with all its chats and buildings. One password entry closes that.
  • Saying the account exists is fine here, unlike on /register, which deliberately answers every address the same. The person has just proved control of the address, which is exactly what the mail link proves.
  • “Forgot the password?” needs a reset by mail, which the server doesn't have yet (access-tokens.md: nothing changes a password today). Until it does, that link is the operator's address. Flagged in the open questions.

4In the app: the card hands off to the browser and gets a session back

The app's sign-in card (login_screen.rs) gets the same two buttons. Google doesn't allow its sign-in inside an embedded view, so the app opens the phone's browser, which comes back to the app when it is done.

Sign in to cartopolis
Sign in to share a world with other people
Server
cartopolis.org
Continue with Google
Continue with GitHub
or
User
your account name
Password
••••••
Stay signed in on this device
Sign in
Offline — the map only
① the card; the buttons appear once the server says it offers them
→
Finish in your browser
We opened Google's sign-in in your browser. Come back here when it's done, or check the browser shows this code:
KQ7-4MD
Waiting for Google…
Open the browser again
Cancel
② waiting; the code is how you tell this sign-in from a fake one
→
🔒 cartopolis.org/app-signin
Signed in as anna
The app asking with code KQ7-4MD is now signed in.
Back to Cartopolis

Didn't start this from the app? Sign it out.

③ the browser; on Android the button is an app link and drops you back in

How it fits what exists

  • No change to the wire. The browser ends with a session token, the app picks it up by its one-time code, and signs in with AuthCredential::Token, the same one “Stay signed in” already uses TODAY.
  • Android: the return is https://cartopolis.org/go/…, the app link the manifest already claims TODAY. Desktop: the app just waits; switching back is enough.
  • The web build of the app runs on cartopolis.org itself, so it does the plain redirect of section 1, with no code.
  • Encrypted chat is not affected. Chat keys are per device. A new phone signed in with Google is a new device, exactly as with a password.

5Your sign-in methods

A small block on the account's page, next to Access tokens (pages/tokens). Link or remove a provider, or add a password to an account that started with Google.

cartopolis.org/account
Ways to sign in
Googleanna.devries@gmail.com · since 24 Oct 2026
Remove
GitHubNot linked
Link
PasswordNone. You sign in with Google.
Add a password
Google is your only way in, so it can't be removed until you link GitHub or add a password.
Making an access token

Confirm it's you before a new token is made.

Confirm with Google

Rules

  • Never zero ways in. The last method can't be removed; the alert above says why instead of the button just being grey.
  • Re-confirming without a password. Making an access token and deleting the account ask for the password again today. An account without one is sent through Google or GitHub again instead, and the server only accepts a sign-in from the last few minutes.
  • Bots stay on access tokens. Nothing here changes how midas bot or a script signs in.

For the operator

  • Admin › People shows a small G / GitHub mark beside accounts that have one. The operator never sees the provider id, only that it is linked.

6Turning it on for a server

Off unless configured, per provider. Every self-hosted server registers its own app with Google and GitHub; nothing is shared through cartopolis.org.

# cartopolis.toml  (or CARTO_AUTH_GOOGLE_CLIENT_ID …)
[auth.google]
client_id     = "1234-abc.apps.googleusercontent.com"
client_secret = "from the environment, never this file"

[auth.github]
client_id     = "Ov23li…"
client_secret = "from the environment"

# redirect to register at each provider:
# https://cartopolis.org/api/auth/google/callback
# https://cartopolis.org/api/auth/github/callback

Server side

  • HTTP only (http.rs): /api/auth/{provider}/start and …/callback, plus /api/auth/app/{code} for the app's pickup. Google is OpenID Connect, so its answer is a signed token we check. GitHub is plain OAuth, so we ask its API for the user and their verified addresses.
  • One new table (provider, provider id, account). A migration, so its number is reserved with midas reserve when built.
  • Caddy needs the new /api/auth/ paths listed, as every player route does.

Open questions

  1. Only Google and GitHub, or any OpenID server too? Cartopolis is meant as a free alternative, and the same code could offer Codeberg, Forgejo (code.garage44.eu), Mastodon or a community's own Keycloak. Drawn: the two you asked for, built so a third is configuration and not code.
  2. Linking an existing account: password once (drawn), or link on the verified address automatically (simpler, but a takeover risk if a provider ever gets an address wrong)?
  3. May an account have no password at all? Drawn: yes, as long as one way in remains. The alternative is asking for a password in section 2 too, which makes the button mostly pointless.
  4. Password reset by mail doesn't exist yet. Section 3's “Forgot the password?” needs it. Build it with this, or leave it as “ask the operator” for now?
  5. Profile picture: take Google's/GitHub's picture as the avatar's chat photo, or never import it (drawn: never)?