Entry point
Screen:AuthIntro (src/screens/Authentication/Login/AuthIntro.jsx)
AUTH_INTRO is the initialRouteName of UnAuthStack and is the first screen any unauthenticated user sees. It presents two actions:
| Button | Action |
|---|---|
| Login | Navigates to LOGIN (the phone number input screen) |
| Start KYC | Navigates to EMAIL_INPUT (the start of the registration flow) |
Login flow
Enter phone number
Screen:
LoginInput (src/screens/Authentication/Login/LoginInput.jsx)The user selects a country dial code (defaulting to +1868 / Trinidad and Tobago) and enters their registered phone number. The phone input enforces that the value always begins with the selected dial code.Tapping Next navigates directly to ENTER_PIN, passing the phone value as a route param.No API call is made on this screen. The phone number is collected and forwarded to the PIN screen, where a single API call handles full authentication.
Enter PIN
Screen: The FCM token is read from AsyncStorage (
EnterPin (src/screens/Authentication/Login/EnterPin.jsx)The user enters their 4-digit PIN. Tapping Confirm sends a single login request:Request body
fcm_token key). If not yet stored, it is fetched and stored via getAndStoreFCM().Session established
On a successful
POST /v2/new-login response:- The JWT token from
data.response.tokenis written to AsyncStorage under the keytoken. setLoggedIn(true)is called onuseAuthStore.setUser(data.response)stores the user object in the auth store.- The navigation stack is reset to
MAIN_STACK, routing the user into the authenticated app.
EnterPin.jsx
Token storage
The JWT token is persisted in AsyncStorage using astorage utility (src/store/LocalStorage/storage.js):
| Key | Value | When written |
|---|---|---|
token | JWT string | After successful login (EnterPin) or after PIN confirmation during registration (ConfirmPin) |
fcm_token | Firebase device token string | When the FCM token is first retrieved |
Root.jsx reads token from AsyncStorage and calls setLoggedIn(!!token). If the token is missing or the read fails, loggedIn remains false.
Deep link support
The app registers adoss:// URL scheme for deep links. Notifications that the user taps to open the app will trigger navigation to the notifications screen:
Root.jsx
onNotificationOpenedApp or getInitialNotification), the app calls Linking.openURL(deep_link.notification) to navigate to the notifications screen.
Deep link navigation only works when the user is already authenticated, since
DOSS_NOTIFICATIONS and ALERT_NOTIFICATIONS are registered exclusively in AuthStack.Token expiry and logout
There is no automatic token refresh mechanism. If a protected API call fails due to an expired or invalid token:- The user must log in again manually.
- Logging out (or a forced session reset) removes the
tokenentry from AsyncStorage and setsloggedIn: falseinuseAuthStore, which causesMainStackto re-render theUnAuthStack.
Profile hydration
AfterloggedIn is set to true, Root.jsx automatically fetches the user profile:
Root.jsx
useAuthStore.user is always up to date with the server state after every login.