Repository navigation
Conversation
- Backend: Better Auth genericOAuth provider configured via OIDC_* env vars (issuer/discovery URL, client id/secret, scopes, button label). - Users are matched to existing accounts by email; the IdP's email claim is trusted. When SSO is linked implicitly to an account with an unverified email, its password, passkeys and older sessions are removed to prevent account pre-hijacking. Accounts linked by their signed-in owner from settings keep their password. - OIDC_ALLOW_SIGNUP toggles auto-creating unknown users on first SSO login. - DISABLE_LOCAL_LOGIN blocks password, magic-link, passkey sign-in and email sign-up (ignored unless OIDC is configured). - Frontend: SSO button on login/register pages, SSO error messages, one-time privacy consent page for SSO-created users, link/unlink card in settings; runtime config exposed through /env.js. - Docs and env examples, including Authentik setup. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XAcVdsLGq2sRWTT5CRqLw2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds single sign-on via OpenID Connect, built for Authentik, on top of Better Auth's
genericOAuthplugin. Users are matched to existing Hive Pal accounts by email address (not case-sensitive).Configuration (env vars only)
OIDC_ISSUER/OIDC_DISCOVERY_URLhttps://auth.example.com/application/o/<slug>/)OIDC_CLIENT_ID,OIDC_CLIENT_SECRETOIDC_PROVIDER_ID<BETTER_AUTH_URL>/api/auth/oauth2/callback/<id>authentikOIDC_SCOPESopenid profile emailOIDC_BUTTON_LABELSign in with SSOOIDC_ALLOW_SIGNUPtrueDISABLE_LOCAL_LOGINfalseSSO turns on once issuer (or discovery URL), client ID and secret are all set. The frontend reads the non-secret flags at runtime from the existing
/env.js.Account linking & security
email_verifiedis false, since Authentik is self-hosted and admin-controlled.requireLocalEmailVerifiedis off. To prevent account pre-hijacking, an implicit link to an account with an unverified email removes that account's password credential, its passkeys and any sessions created before the link. The data stays; the owner can set a new password via "forgot password". The email is then marked verified.Frontend
DISABLE_LOCAL_LOGINis on./account/consent) for SSO-created users. They skipped the signup form, so this is where they accept the privacy policy.Docs
Self-hosting configuration docs now include an Authentik setup guide, and both
.env.examplefiles list the new variables.Testing
oidc-config.spec.ts,oidc-linking.spec.ts(13 pass). Backend and frontend typecheck clean; eslint clean on changed files.OIDC_ALLOW_SIGNUP=false→error=signup_disabledDISABLE_LOCAL_LOGIN=true→ 403 on password, signup and magic link while SSO still works🤖 Generated with Claude Code
https://claude.ai/code/session_01XAcVdsLGq2sRWTT5CRqLw2
Generated by Claude Code