Meteor authentik#385
Open
Dharp02 wants to merge 13 commits into
Open
Conversation
Keep /api/whoami endpoint and add / and /health endpoints from meteor-is-back branch
Resolved conflict in meteor-backend/server/teams.js by keeping meteor-authentik version that correctly removes targetUserId when removing team members.
- Remove backend/nginx-apple-proxy.conf (machine-specific nginx config) - Remove meteor-backend/start-rosetta.sh (machine-specific dev script) - Add both to .gitignore to prevent future commits
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.
feat: Migrate Auth to Meteor Accounts + Authentik Proxy Support
Summary
This PR migrates the authentication layer from a custom JWT bridge system to Meteor's built-in Accounts system, adds support for Authentik SSO via the os.mieweb.org forward auth proxy, and fixes the database configuration mismatch between Fastify and Meteor backends.
What Changed
1. Auth Bridge Migration (
meteor-backend/server/auth-bridge.js)Before:
connectionIdentityMap tracking DDP sessions manuallyauth.bridgeMeteor method called by frontend on every connectrequireIdentity()only checked JWT/PAT tokensAfter:
Accounts.registerLoginHandler('oidc')— handles GitHub/Google/Apple JWTs from FastifyAccounts.registerLoginHandler('pat')— handles Personal Access TokensAccounts.registerLoginHandler('proxy')— handles Authentik proxy JWTsrequireIdentity()restored to handle both DDP (this.userId) and REST/MCP (currentBearerToken()) pathsfindOrCreateUser()syncs Fastifyusercollection with Meteoruserscollection using same_idsignProxyJwt()/verifyProxyJwt()for Authentik proxy JWT signing2. Authentik Proxy Auth (
meteor-backend/server/main.js)Added new HTTP endpoint:
X-Email,X-User-First-Name,X-User-Last-Nameheaders injected by os.mieweb.org proxyPROXY_JWT_SECRET{ token }to frontendTRUST_PROXY_HEADERS=trueenv var3. All 14 Method Files Updated
Updated all Meteor method files to use
requireIdentity(this)instead ofthis.userIddirectly, enabling both DDP and REST/MCP auth paths:clock.jstickets.jsorganizations.jsteams.jschannels.jstokens.jsactivity.jsusers.jsmessages.jsenterprises.jsnotifications.jstimers.jsattachments.jspresence.js4. Frontend DDP Client (
src/lib/ddp.ts)Before:
auth.bridge(token)manuallyreauthTimerAfter:
login({ oidcJwt: token })via Meteor Accounts protocollogin({ proxyJwt: token })for Authentik userslogin({ resume: token })for reconnects (automatic)meteor_resume_tokenin localStoragetryResumeLogin()handles reconnects automaticallyloginWithProxy()calls/api/whoamifor Authentik flowreauthTimer— Meteor resume tokens handle this natively5. Infrastructure Fixes
Database:
timehuddle→timeharbor)timeharbordatabaseNginx (
/etc/nginx/sites-available/timehuddleon timecore-dev):/websocketroute from port4000(Fastify) to port3100(Meteor)PM2 (
backend/ecosystem.config.cjs):TRUST_PROXY_HEADERS=trueto Meteor envPROXY_JWT_SECRETto Meteor envMONGO_URLto point totimeharbor6. Social Providers Cleanup (
src/lib/socialProviders.ts)authentikfrom the social provider registryNew Environment Variables Required
meteor-backend(timecore-dev server):Auth Flow Diagrams
GitHub/Google/Apple Login
Authentik Login (os.mieweb.org proxy)
Reconnect (all users)
Testing
Tested ✅
Known Issues / Next Steps
.well-known/apple-developer-domain-association.txtdeployed/v1/mesession/v1/*routes for new users not yet in Fastify sessionaccounts-googleandaccounts-githubpackages not yet added to Meteor (Phase 2)Phase 2 Plan (Next PR)
Related Issues