Skip to content

Commit 6dc98b8

Browse files
committed
chore (doc): update README.md for authorisation
1 parent 8928674 commit 6dc98b8

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

README.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,72 @@ Demo mobile app scaffold for Aussie, built with **React Native v0.80.0**. It sho
1818
- **Design System:** Centralized theme with light/dark palettes, spacing/typography tokens, and a `makeStyles` helper to build component styles from the theme.
1919
- **Global State:** Zustand-powered root store with a composable preference slice for FaceID, haptics, and theme selection.
2020
- **Local Persistence:** `react-native-mmkv-storage` caches preference data through a JSON-backed storage adapter.
21+
- **Authentication:** Auth0 integration with OpenID Connect (OIDC) service, enabling secure login with Auth0 and automatic biometric authentication when FaceID is enabled. Token management uses iOS Keychain and Android Keystore via `react-native-keychain` for secure credential storage, with automatic token refresh and session management.
2122
- **Screens:** Draft UI implementations for Home, Finances, MyBroker (profile), Properties, and Appointment flows.
2223
- **Testing:** Jest + React Native Testing Library configured for colocated component tests and store tests (with MMKV + icon mocks).
2324
- **E2E Testing:** Detox integrated for end-to-end testing with comprehensive test coverage for all 5 tabs and 6 screens.
2425
- **Deep Linking:** Schema URL support (`aussie://`) with React Navigation linking configuration for seamless navigation to specific screens.
2526
- **Animations:** `react-native-reanimated` implemented for smooth button interactions with scale and opacity animations matching the original app design.
2627
- **Tooling:** ESLint, Prettier, and Husky-friendly npm scripts, plus a simple CI workflow that lints, formats, and tests on every push/PR.
2728

29+
### Authorisation
30+
31+
The authentication flow integrates Auth0 with OpenID Connect, secure token storage in Keychain, and biometric auto-login:
32+
33+
```mermaid
34+
flowchart TD
35+
Start([App Launch]) --> CheckTokens{Tokens in<br/>Keychain?}
36+
37+
CheckTokens -->|No| Login[Login Screen]
38+
CheckTokens -->|Yes| CheckFaceID{FaceID<br/>Enabled?}
39+
40+
Login --> Auth0[Auth0 OIDC Login]
41+
Auth0 -->|Success| SaveTokens[Save Tokens to Keychain]
42+
Auth0 -->|Error| Login
43+
44+
SaveTokens --> GetUser[Get User Info]
45+
GetUser --> Authenticated[✓ Authenticated]
46+
47+
CheckFaceID -->|No| Login
48+
CheckFaceID -->|Yes| FaceID[FaceID Prompt]
49+
50+
FaceID -->|Success| CheckValid{Tokens<br/>Valid?}
51+
FaceID -->|Failed| Login
52+
53+
CheckValid -->|Yes| GetUser
54+
CheckValid -->|No| Refresh[Refresh Token]
55+
56+
Refresh -->|Success| SaveTokens
57+
Refresh -->|Failed| Login
58+
59+
Authenticated --> UsingApp[Using App]
60+
Authenticated --> Logout[Logout]
61+
62+
UsingApp --> TokenCheck{Token<br/>Expired?}
63+
TokenCheck -->|Yes| Refresh
64+
TokenCheck -->|No| UsingApp
65+
66+
Logout --> ClearTokens[Clear Keychain]
67+
ClearTokens --> ClearAuth0[Clear Auth0 Session]
68+
ClearAuth0 --> Login
69+
70+
style Start fill:#e1f5ff
71+
style Authenticated fill:#d4edda
72+
style Login fill:#fff3cd
73+
style Auth0 fill:#cfe2ff
74+
style SaveTokens fill:#cfe2ff
75+
style FaceID fill:#f8d7da
76+
style Refresh fill:#d1ecf1
77+
style UsingApp fill:#d4edda
78+
```
79+
80+
**Key Components:**
81+
- **Auth0 Service**: Handles OIDC authentication, token refresh, and user info retrieval
82+
- **Keychain Storage**: Securely stores access tokens, ID tokens, and refresh tokens using `react-native-keychain`
83+
- **Biometric Service**: Manages FaceID/TouchID authentication for seamless auto-login
84+
- **Auth Store**: Zustand store managing authentication state, user data, and token lifecycle
85+
86+
2887
### Detox testing
2988

3089
https://github.com/user-attachments/assets/9bae7715-8d3a-456c-a07a-30379eeef251

0 commit comments

Comments
 (0)