Firebase Authentication is widely used for secure and scalable authentication across web and mobile platforms. However, Firebase Auth currently lacks first-class session management and device-level visibility, which are now standard expectations for modern applications.
This proposal suggests introducing optional Session Management for Firebase Auth, enabling developers to view, manage, and revoke login sessions across devices using Firebase Admin SDK and (optionally) Client SDKs.
Firebase Authentication today provides:
- Token-based authentication (ID tokens, refresh tokens)
- Global refresh-token revocation
- Basic user metadata (
lastSignInTime,creationTime)
However, it does not provide:
- Visibility into active login sessions
- Information about device type, OS, or platform
- Approximate geographic context of logins
- Per-session logout capability
- Session-level last active timestamps
As a result, developers must build and maintain custom infrastructure for session tracking, increasing complexity and introducing inconsistent security implementations.
Each successful authentication creates a session object associated with the user.
A session would include:
sessionIduidcreatedAtlastActiveAtstatus(active / revoked / expired)- Authentication method (password, OAuth provider, SSO, etc.)
Firebase Auth should optionally capture sanitized, structured metadata derived from the User-Agent header at login time.
-
Device category
- Desktop / Mobile / Tablet
-
Operating system
- Windows, macOS, Linux, Android, iOS
-
OS version (optional, coarse-grained)
-
Browser or runtime
- Chrome, Firefox, Safari, Edge
- Android WebView
- iOS App
-
Application type
- Web
- Android App
- iOS App
Raw User-Agent strings should not be exposed to clients. Firebase should internally parse and normalize this data into structured fields.
This aligns with how many platforms already process User-Agent headers for analytics and security while preserving privacy.
Each session may include approximate location data, derived from IP at login time:
- Country
- Region / State (optional)
- City (optional)
Privacy considerations:
- No raw IP addresses exposed
- Approximate resolution only
- Configurable granularity or full opt-out
Provide new Admin SDK APIs to:
admin.auth().listUserSessions(uid)
admin.auth().revokeSession(uid, sessionId)
admin.auth().revokeAllSessions(uid)
admin.auth().revokeAllExcept(uid, currentSessionId)Admins can:
- Inspect all active sessions
- Identify suspicious or unused sessions
- Revoke sessions selectively
Allow developers to expose a “Logged-in Devices” UI for end users.
Each session could display:
- Device type & OS (e.g., Windows · Chrome)
- Approximate location (e.g., Mumbai, India)
- Last active time
- Current session indicator
- Logout button (per session)
Firebase Auth updates lastActiveAt when:
- Refresh tokens are used
- Tokens are validated beyond a configurable interval
This enables:
- Detection of inactive sessions
- Auto-expiry rules
- Better security auditing
-
Feature is opt-in per Firebase project
-
Developers control:
- Session retention duration
- Location granularity
- Client visibility
-
No sensitive raw headers or IP addresses exposed
-
Client SDK can only access own user’s sessions
-
Admin SDK has full control
- Eliminates custom session-tracking implementations
- Simplifies security features like “Log out from other devices”
- Reduces backend complexity and bugs
- Transparency into account usage
- Improved account security
- Familiar UX seen in major platforms
- Closes a major feature gap vs Auth0, Cognito, and enterprise IdPs
- Makes Firebase Auth viable for security-sensitive SaaS and enterprise apps
| Platform | Device Info | OS Info | Per-Session Logout |
|---|---|---|---|
| Google Account | ✅ | ✅ | ✅ |
| Auth0 | ✅ | ✅ | ✅ |
| AWS Cognito | |||
| Firebase Auth | ❌ | ❌ | ❌ |
- Admin SDK support first
- Opt-in via Firebase Console
- Client SDK read-only support
- Gradual rollout with quotas and pricing tiers if needed
Introducing session management with device, OS, and approximate location visibility would significantly enhance Firebase Authentication’s security and usability. By deriving structured metadata from User-Agent headers in a privacy-safe manner, Firebase can provide enterprise-grade session control while maintaining its simplicity-first philosophy.