Add self-hosted Google auth#25
Merged
Merged
Conversation
0769ed9 to
85adc97
Compare
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.
Original request
The project is being prepared for open source/self-hosting. The current Google sign-in path depends on closed-source Cleverbrush Passport, which should remain available for Cleverbrush deployment, while self-hosters need a direct Google OAuth option using Auth.js-standard
AUTH_GOOGLE_IDandAUTH_GOOGLE_SECRET. The README should document this thoroughly.What changed
POST /api/auth/google/sign-inguarded byX-Xpenser-Web-Secret.googleuser andexternal_identitieslinking rules.GOOGLE_SIGN_IN_MODE=auto|direct|passport|disabled.AUTH_GOOGLE_IDandAUTH_GOOGLE_SECRET.https://auth.cleverbrush.comfrom self-hosted env/Compose defaults; PR environments explicitly set Passport mode..env.example, Compose files, PR env docs/scripts, landing-page copy, and README authentication docs for self-hosted direct Google and private Passport.Reasoning
Direct Google OAuth should not introduce a second account model. The API already stores
authProvider = 'google'users and external Google identity rows for Passport-created accounts, so the direct Auth.js path now feeds the same resolver. This preserves conflict behavior: verified Google email is required, local email/password accounts are not silently linked, and a user can only have one Google identity.automode gives self-hosters a minimal setup: addingAUTH_GOOGLE_IDandAUTH_GOOGLE_SECRETenables direct Google sign-in, while leaving both Google and Passport unset hides the button and keeps email/password auth working. Cleverbrush deployments opt into Passport explicitly.Screenshots / preview evidence
Preview URL: https://xpenser-pr-025.cleverbrush.com
Manual preview QA with
agent-browser:/loginrenders email/password login plusSign in with Googlein PR Passport mode.Sign in with Googlestarts the existing Passport-to-Google redirect path and reaches Google OAuth withauth.cleverbrush.comas the OAuth app domain.test@cleverbrush.comreaches/dashboardand renders the authenticated dashboard.Direct Google OAuth is covered by unit tests and docs because completing the real external Google OAuth callback in CI would require provider credentials and a user-controlled Google account.
Validation
Local validation performed from
feat/self-hosted-google-auth:npm run lintpassed.npm run typecheckpassed.npm testpassed: 54 test files, 306 tests.GitHub checks on commit
85adc9741cad3ac653ad22b21cb913bd99e35316:Lint and testpassed.Deploy PR environmentpassed.Playwright e2epassed.SigNoz verification after preview QA:
xpenser-web-pr-25orxpenser-api-pr-25; recent successful web and API spans are present.ERRORorFATALlogs forxpenser-web-pr-25orxpenser-api-pr-25.nodejs.eventloop.utilizationis present forxpenser-api-pr-25; web metrics were not listed in the metrics metadata, but web traces/logs were present and clean.