Repository navigation
Description
Summary
app/setup.sh is broken for new developer onboarding. The script configures the app with based-hardware-dev Firebase credentials, but the dev backend (api.omiapi.com) now verifies tokens against based-hardware (prod Firebase). Since Firebase ID tokens are project-scoped, every API call from a setup.sh-onboarded app returns 401 Unauthorized.
Root Cause
On Feb 19, 2026, commit a3b1efa (@kodjima33) changed the dev GKE backend to use GOOGLE_CLOUD_PROJECT=based-hardware (prod Firebase) for token verification. This was intentional — making dev behave as staging (dev API wired to prod database/Firebase for faster TestFlight verification).
However, app/setup.sh and its prebuilt configs were never updated to match:
| Component | Firebase Project | File |
|---|---|---|
setup/prebuilt/firebase_options.dart |
based-hardware-dev |
projectId: 'based-hardware-dev' |
setup/prebuilt/google-services.json |
based-hardware-dev |
"project_id": "based-hardware-dev" |
setup/prebuilt/GoogleService-Info.plist |
based-hardware-dev |
PROJECT_ID: based-hardware-dev |
| Dev backend (api.omiapi.com) | based-hardware |
GOOGLE_CLOUD_PROJECT=based-hardware in Helm values |
Token Verification Flow
- App signs user into
based-hardware-devFirebase → gets ID token scoped tobased-hardware-dev - App sends request to
api.omiapi.comwith Bearer token - Backend calls
firebase_admin.auth.verify_id_token(token)— initialized withGOOGLE_CLOUD_PROJECT=based-hardware - Verification fails: token audience is
based-hardware-dev, expectedbased-hardware→ 401
Impact
- All new developers running
bash setup.sh iosorbash setup.sh androidget a non-functional app - Sign-in succeeds (Firebase Auth works independently per project) but every subsequent API call fails
- No error message explains the mismatch — developers see generic auth failures
Key Files
app/setup.sh(lines 52, 78-90) — sets API URL and copies prebuilt configsapp/setup/prebuilt/firebase_options.dart—projectId: 'based-hardware-dev'app/setup/prebuilt/google-services.json—project_id: based-hardware-devapp/setup/prebuilt/GoogleService-Info.plist—PROJECT_ID: based-hardware-devbackend/charts/backend-listen/dev_omi_backend_listen_values.yaml(line 265-266) —GOOGLE_CLOUD_PROJECT: based-hardware
Fix Options
- Update prebuilt configs to
based-hardware— regenerate all 3 prebuilt files against prod Firebase project. Simplest fix but requires prod Firebase access to generate configs. - Add dual-project token verification — backend accepts tokens from both
based-hardware-devandbased-hardware. More complex, maintains backward compatibility. - Revert dev backend to
based-hardware-dev— undo the staging migration. Not recommended since the migration was intentional for TestFlight workflow.
Option 1 is the recommended path — it aligns setup.sh with the current backend reality.
Activity
beastoin commentedon Mar 23, 2026
Codex review confirms the analysis (gpt-5.3-codex, 130k tokens).
Additional findings:
pusherdev chart was also changed toGOOGLE_CLOUD_PROJECT=based-hardwarein the same batch (commit0ac298d92) — any fix must keep listen/pusher aligned.setup.shsetsUSE_AUTH_CUSTOM_TOKEN=truein.dev.env, which triggers the backend's/v1/auth/tokencustom token flow (firebase_admin.auth.create_custom_token()). This complicates option (b) (dual-project verification) because custom tokens generated against prod Firebase won't work for dev-project-signed-in users.app/e2e/SKILL.mdline 435 already documents this exact problem: "iOS simulator auth (dev Firebase tokens rejected by prod API — needs local backend)"Recommended fix path:
based-hardware(prod Firebase). Fastest unblock.based-hardware-devFirebase, preserving staging parity on the main dev backend while restoring zero-friction onboarding.cc @kodjima33 — this broke when the dev→staging migration landed (Feb 19, a3b1efa).
beastoin commentedon Mar 23, 2026
Note: The fix recommendations above (options a–d) are Codex-generated suggestions only — not verified or approved by the CTO. Implementation should wait for CTO review and direction on the preferred approach.
formed2forge commentedon Jun 25, 2026
This continues to leave a large hurdle to get started developing / working on fixes on mobile for community developers. With the current state, not only does a community dev need to essentially spin up their own backend to just get past the auth hangup (certainly on iOS and presumably on Android as well), but with changes happening regularly on the omi backend, it also means that your community devs need to manage those backend changes in parallel while working on any mobile-related work. Solving this could only encourage community involvement in contributing meaningfully at the mobile-app level which is the primary entry-point to the OMI ecosystem for most people. I've worked out a solution based on what I can see from my end.
Potential Fix + PR approach
Following up on PR #5945 being closed — the Greptile review correctly identified it was incomplete (text-replace only updated
projectId, leavingstorageBucketandauthDomainstill pointing atbased-hardware-dev). This comment documents the correct fix approach and a ready-to-use PR description.Why text-replace doesn't work
The
apiKey,appId,clientId,storageBucket, andauthDomainvalues are all project-specific credentials that differ betweenbased-hardware-devandbased-hardware. Only a full regeneration via FlutterFire CLI (or direct Firebase console download) produces correct values for all fields.Two broken paths — both need fixing
setup.shhas two independent code paths, both broken:setup_firebase()) — used by most community devs; copies files fromsetup/prebuilt/to dev and prod flavor directoriessetup_firebase_with_service_account()) — used in CI when$FIREBASE_SERVICE_ACCOUNT_KEYis set; runsflutterfire configdirectlyFix: prebuilt path (Steps 1–3)
Run this from inside the
app/directory (requiresfirebase loginand Firebase console access tobased-hardware):This writes all three files (
firebase_options.dart,GoogleService-Info.plist,google-services.json) intosetup/prebuilt/with correct credentials for all fields — includingstorageBucket,authDomain, andclientId.If CLI access isn't available, the three files can also be downloaded manually from the Firebase console (
based-hardwareproject → Project Settings → Your apps) for thecom.friend.ios.dev(Android) andcom.friend-app-with-wearable.ios12.development(iOS) apps.Fix: service account path (Step 4)
In
app/setup.sh, update both occurrences insetup_firebase_with_service_account:Line 105 (dev flavor):
Line 117 (prod flavor):
PR description (ready to copy)
The fix itself requires someone with
based-hardwareFirebase console access — happy to test and refine the on-boarding script once it lands.docs(app): point mobile setup at the local harness, not api.omiapi.com
docs(app): point mobile setup at the local harness, not api.omiapi.com (