The Panahashi Baker API authenticates requests with Firebase ID tokens passed as Bearer credentials. The mobile app obtains a short-lived ID token from Firebase Auth after sign-in, injects it into every request, and handles 401 responses by throwing a sentinel error that triggers a re-login flow. You do not need to implement token refresh manually — Firebase handles it automatically.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/AndrewwCO/Pana-Baker/llms.txt
Use this file to discover all available pages before exploring further.
How the token reaches the API
After a successful Firebase sign-in,onAuthStateChanged fires with the authenticated user. The app calls firebaseUser.getIdToken() to obtain an ID token, then registers it on the shared API client:
api.setToken(token) and api.setUserName(name) store the values in memory on the singleton ApiService instance. They are applied automatically to every subsequent request.
Request header format
Include both headers on every API call:curl:
401 responses
When the server returns HTTP 401, the API client throws immediately:Error("NO_AUTH") should prompt the user to sign in again. The app’s navigation layer listens for this sentinel and redirects to the login screen.
Firebase ID tokens expire after one hour.
firebaseUser.getIdToken() automatically returns a fresh token when the current one is near expiry — you do not need to call a refresh endpoint or manage expiry timestamps yourself. Re-calling getIdToken() before each request is safe and recommended for long-running sessions.Other non-2xx responses
For any HTTP error other than 401, the client reads the response body and throws:{ "message": "..." } payload when available, or falls back to the raw status code string.