Firebase
Use the Firebase project that authenticates your app’s users. In Projects → your project → General → Authentication → Firebase, enter its project ID, choose a customer-deprovisioning policy and connect. The project ID can come from a linked 1Password field. Once connected, this editor does not let you change the project’s identity in place.
Supply an ID token
import { getAuth } from 'firebase/auth'
import { createCustomerClient } from '@preternatural-js/client-sdk'
const client = createCustomerClient({
environment: 'production',
projectId: 'YOUR_MODEM_PROJECT_ID',
authentication: {
type: 'identity-token-provider',
getIdentityToken: async () => {
const user = getAuth().currentUser
if (!user) throw new Error('Sign in before using Modem')
return await user.getIdToken()
}
}
})Initialize Firebase and complete sign-in before using this client. Return the Firebase Authentication ID token, not an Admin SDK custom token or a Google OAuth access token. Firebase’s ID-token verification guide explains the distinction.
Modem requires an RS256-signed token with a signing-key ID, the configured Firebase project as audience, issuer https://securetoken.google.com/YOUR_FIREBASE_PROJECT_ID, a valid Firebase UID, and valid auth_time, iat and exp times. Tenant-bearing Firebase tokens are not supported by this verifier. Do not remove the tenant field from a token; use a supported identity configuration instead.
Deletion events
ID-token verification alone is not a deletion-notification integration. If your app deletes Firebase users, configure the Firebase deletion relay described in admin integrations. Keep the relay credential on your server. An accepted deletion notification and completed downstream subscription cancellation are separate outcomes.
See provider lifecycle before disconnecting the Firebase connection or changing deprovisioning behavior.
Verification failures
Check project ID and token type first when identification fails. A token for one Firebase project does not authenticate against another.
Modem refreshes Google’s signing certificates and caches them according to the provider’s response. A new signing-key ID can trigger a refresh. A temporary certificate-fetch failure produces a verification-unavailable response; it does not establish that the user is invalid. Acquire a fresh ID token for expired-token errors, and retry temporary verification failures without deleting the customer.