Skip to Content
Engineering11 Documentation πŸ”₯
FrontendCapabilitiesAuthentication

Authentication

Firebase Auth integration across all platforms β€” login, token management, route protection, and biometrics handled out of the box. You configure auth parameters and customize post-login routing.

What the Foundation Provides

CapabilityFlutterAngularReact (Web)React Native
Email/password loginβœ“βœ“βœ“βœ“
OAuth (Google, Apple)β€”βœ“β€”β€”
Password reset / managementβœ“βœ“βœ“βœ“
Email verificationβœ“βœ“β€”βœ“
Token refreshβœ“ (automatic via Firebase)βœ“ (automatic via Firebase)βœ“ (useUserTokenRefresh)βœ“ (useIdToken)
Auth interceptorsβœ“ (Dio interceptor)βœ“ (HTTP interceptor)βœ“ (Axios interceptor)βœ“ (Axios interceptor)
Route/screen protectionβœ“ (navigation service)βœ“ (multi-layered guards)βœ“ (middleware)βœ“ (Stack.Protected)
Session timeoutβ€”βœ“ (1hr default, 30min warning)βœ“ (inactivity monitor)β€”
Biometric loginβœ“ (Face ID / Touch ID)β€”β€”βœ“ (Face ID / Touch ID)
Secure credential storageβœ“ (FlutterSecureStorage)β€”βœ“ (cookie via middleware)βœ“ (Expo SecureStore)
RBAC / Permissionsβœ“ (sdk_access)βœ“ (access-web + Firestore)βœ“ (access-frontend-sdk)β€”
Pre-built auth UIβ€”βœ“ (login, signup, password reset)βœ“ (Login, ForgotPassword, ManagePassword)βœ“ (Login, VerifyEmail, ManagePassword)

How It Works

Token Flow

All platforms follow the same pattern: Firebase Auth issues JWTs with custom claims (roles, products, tenant). Tokens are automatically refreshed by the Firebase SDK and attached to every API request via platform-specific interceptors.

Custom claims structure:

{ appUserId: string bootstrapTenantKey: string customerKey: string products: string[] roles: string[] email_verified: boolean }

Auth Interceptors

Every outbound HTTP request gets auth headers attached automatically:

HeaderPurposePlatforms
Authorization: Bearer <jwt>API authenticationAll
X-TENANT-IDMulti-tenant routingAll
X-Firebase-AppCheckRequest integrity verificationFlutter, React/RN
X-Service-RequestOpt-in token injection flagAngular

Flutter uses a Dio RestClientInterceptor that also checks network connectivity before every request. Two variants exist: public (allows unauthenticated) and authenticated (rejects if no user).

Angular uses HttpServiceInterceptor gated by an X-Service-Request header flag, reading tokens from localStorage.

React / RN uses Axios interceptors in the RestClient with automatic retry and tenant header injection.

Route Protection

PlatformMechanismPattern
FlutterAbstract NavigationServiceModule facades control screen entry; auth state drives navigation
AngularMulti-layered guardssuperGuard enforces: Authenticated β†’ Terms β†’ Email Verified β†’ Destination
React (Web)Next.js middlewarenext-firebase-auth-edge validates on every server request with role-based redirects
React NativeExpo RouterStack.Protected with guard={isAuthenticated}

RBAC

Flutter and Angular both implement a product Γ— role β†’ permissions model backed by Firestore. The Angular implementation (@engineering11/access-web) stores permission maps in access_permission_maps/ and exposes PermissionStore, PermissionsGuard, and UseLimitService. React web provides PermissionProvider with hook-based permission checks.

What You Customize

You ProvideExample
Auth config (URLs, tenant ID)AuthConfig, BaseAuthConfigProvider, Firebase project IDs
Post-auth routingWhere to redirect after login, role-based landing pages
Logout cleanupUnsubscribe Firestore listeners, clear notification tokens, reset stores
Permission definitionsWhich permissions map to which roles for your product
Login screen brandingApplied via the theming system, not auth code

Next Steps

Last updated on