Skip to content

Auth + identity bootstrap #15

@Joel-Joseph-George

Description

@Joel-Joseph-George

Context

Background

No login flow for mvp. userId and userEmail are hardcoded in .env
and bootstrapped into MMKV on first launch. We then fetch the user record
from the server and write it into SQLite as the FK anchor for all subsequent
syncs.

Tasks

MMKV bootstrap

  • Read USER_ID and USER_EMAIL from .env at app startup
  • Write both into MMKV on first launch: userId (int), userEmail (string)
  • Wire userEmail into the existing request interceptor as the
    x-user-email header on all authenticated requests

User identity fetch

  • Call GET /users/email/:email using userEmail from MMKV
  • Upsert the response into SQLite users table:
Column Source
id response id
username response username
email response email
first_name response firstName
last_name response lastName

MMKV keys set here

Key Value Set when
userId 00 App startup
userEmail user@fluent.com App startup

Acceptance criteria

  • Every authenticated API request carries x-user-email header
  • userId and userEmail are readable from MMKV immediately after app launch
  • users table has exactly 1 row after first launch
  • Re-running does not duplicate the row (upsert on id)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Dev Ready

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions