Subscribe to the Non-Human & AI Identity Journal

Notifications
Clear all

iOS external tokens and Firebase sessions: what teams need to know


(@nhi-mgmt-group)
Member Moderator
Joined: 1 year ago
Posts: 15754
Topic starter  

TL;DR: An external token flow can bridge native login methods into Firebase by minting a Firebase custom token during authentication and reusing the existing UID and Firestore rules, according to Descope’s iOS guide. The pattern matters because it removes backend friction, but it also makes token handling and session trust boundaries part of the identity design, not just the app UX.

NHIMG editorial — based on content published by Descope: Add External Tokens to Your iOS + Firebase App Developers

Questions worth separating out

Q: How should teams govern external token exchange in mobile apps?

A: Treat external token exchange as a federation pattern with its own trust boundary.

Q: Why do short-lived bearer tokens still need governance?

A: Short-lived bearer tokens reduce replay exposure, but they do not prevent misuse after issuance.

Q: What breaks when the external subject does not match the Firebase UID?

A: Authorization becomes inconsistent.

Practitioner guidance

  • Define the token issuer as a governed trust boundary Document which system mints the external token, what claims it carries, and who owns connector configuration and rotation.
  • Validate subject mapping across every downstream Firebase service Confirm the external identity subject resolves to the same Firebase UID in Auth, Firestore, Storage, and callable functions so authorisation does not drift between services.
  • Keep external tokens ephemeral and non-persistent Store the token only in memory, expire it quickly, and force reauthentication if the token is lost, reused, or the app session changes context.

What's in the full article

Descope's full guide covers the operational detail this post intentionally leaves for the source:

  • Step-by-step Swift implementation for wrapping the Descope flow in a SwiftUI app.
  • Exact connector setup for minting Firebase custom tokens from a service account JSON file.
  • Sample code for exchanging the external token with signIn(withCustomToken:) and reading Firestore.
  • Firebase rule configuration and sample project structure for the full iOS workflow.

👉 Read Descope's guide to external tokens for iOS and Firebase →

iOS external tokens and Firebase sessions: what teams need to know?

Explore further

View Full Forum →  |  NHI Foundation Course →



   
Quote
(@mr-nhi)
Member Moderator
Joined: 3 months ago
Posts: 15339
 

External token login creates an identity delegation chain, not just a smoother UX. The article shows a user authenticating in one system and receiving a Firebase custom token that another system accepts as proof. That means the real security boundary sits in the delegation chain between issuer, connector, and relying party. For practitioners, the lesson is that auth simplification does not remove governance complexity; it moves it into token trust, subject mapping, and session scope.

A few things that frame the scale:

  • 80% of organisations report their AI agents have already performed actions beyond their intended scope, including accessing unauthorised systems (39%), inappropriately sharing sensitive data (31%), and revealing access credentials (23%), according to AI Agents: The New Attack Surface report.
  • 33% of organisations report their AI agents have accessed inappropriate or sensitive data beyond their intended scope.

A question worth separating out:

Q: How can security teams test whether token-based sign-in is actually safe?

A: Test the full path end to end, from token minting through session creation to protected resource access. Confirm expiry behaves as expected, the token is not persisted unnecessarily, and every downstream service enforces the same identity and access assumptions.

👉 Read our full editorial: External token exchange closes the iOS Firebase auth gap



   
ReplyQuote
Share: