mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-04 05:17:01 +01:00
Loki's GitHub sign-in, and the repo and workflow grant "Start a new
project" acts with, waited on the bitbaum sign-in getting provider
credentials. AccountKit 0.22 brings a product's own GitHub app across at
its existing callback: GitHub is offered again on this runtime, with
githubScopes repo and workflow; a signed-in person pressing GitHub links
it ("Connect GitHub"); a new link's token goes to Loki's accounts, where
the GitHub features read it. GitHub links made under Auth.js are recorded
in AccountKit's table (the import, and migration 0133 on the switched
box), so they sign the same person in. The deploy's provider check
expects GitHub when the box has the app.
Also: prove's real-inbox step retries mail.tm when several proofs run at
once.
Claude-Session: https://claude.ai/code/session_019MDtmud6zcK4rStBGmYSML
Co-authored-by: Claude <noreply@anthropic.com>
55 lines
2.3 KiB
TypeScript
55 lines
2.3 KiB
TypeScript
/**
|
|
* The provider ids a deploy must find in /api/auth/providers, derived from the
|
|
* same rules that mount them, so pausing or adding a provider never needs a
|
|
* second edit here. Prints them space-separated; scripts/deploy-hetzner.sh
|
|
* reads the line.
|
|
*
|
|
* npx tsx scripts/expected-auth-providers.ts # → "github email-password"
|
|
* AUTH_RUNTIME=accountkit npx tsx scripts/expected-auth-providers.ts
|
|
* # → "email-password"
|
|
*
|
|
* The env is the BOX's, as deploy-hetzner.sh reads it from /opt/fleet/env and
|
|
* /opt/loki/app/.env: AUTH_RUNTIME, the non-secret OIDC names
|
|
* (ORANGECAT_OAUTH_ISSUER/CLIENT_ID, SIGNIN_ISSUER/CLIENT_ID) and, for each
|
|
* secret, only whether it is set (never its value).
|
|
*
|
|
* - Auth.js runtime: GitHub, Google and X when not paused (PAUSED_PROVIDERS in
|
|
* src/lib/auth-providers.ts), plus the password form.
|
|
* - AccountKit runtime (AUTH_RUNTIME=accountkit, live since 2026-11-01): the
|
|
* compat layer lists GitHub through Loki's own app (GITHUB_CLIENT_*,
|
|
* productGithubApp), the password form, and every OIDC client AccountKit
|
|
* mounts from env — `orangecat` with ORANGECAT_OAUTH_*, `bitbaum-signin`
|
|
* with SIGNIN_* (oidcClients). Google and X are not mounted there. Not
|
|
* expecting what the runtime mounts let OrangeCat vanish unnoticed once.
|
|
*/
|
|
import { oidcClients, productGithubApp } from "@bitbaum/accountkit/auth";
|
|
import { sharedRuntimeEnabled } from "@bitbaum/accountkit/auth/switch";
|
|
|
|
import { PAUSED_PROVIDERS } from "../src/lib/auth-providers";
|
|
|
|
/** Every provider production configures on Auth.js, by the id /api/auth/providers lists. */
|
|
const CONFIGURED = [
|
|
{ key: "github", id: "github" },
|
|
{ key: "google", id: "google" },
|
|
{ key: "x", id: "x-1a" },
|
|
] as const;
|
|
|
|
export function expectedAuthProviders(env: NodeJS.ProcessEnv = process.env): string[] {
|
|
if (sharedRuntimeEnabled(env)) {
|
|
return [
|
|
// Loki opts its own GitHub app in (githubSignIn: true in its runtime).
|
|
...(productGithubApp(env, true) ? ["github"] : []),
|
|
"email-password",
|
|
...oidcClients(env).map((client) => client.providerId),
|
|
];
|
|
}
|
|
return [
|
|
...CONFIGURED.filter(({ key }) => !PAUSED_PROVIDERS[key]).map(({ id }) => id),
|
|
"email-password",
|
|
];
|
|
}
|
|
|
|
if (process.argv[1]?.endsWith("expected-auth-providers.ts")) {
|
|
console.log(expectedAuthProviders().join(" "));
|
|
}
|