mockUserToken property

Object? mockUserToken
final

The token sent to the Firestore emulator to authenticate the requests, set with withEmulator (the only way to set it: it is never sent to a host that was not configured as an emulator). Same as the mockUserToken option of connectFirestoreEmulator in the JS SDK; meant for testing security rules, it replaces the token of Firebase Auth.

Either a token string, sent as is (the user is mock-user), or a Map<String, Object?> with the claims of a Firebase ID token, which is encoded as an unsigned JWT for the project of the app. The claims need a sub or user_id, which becomes the user id; missing claims get defaults. For example {'sub': 'alice', 'email': 'alice@example.com'}.

Implementation

final Object? mockUserToken;