use of com.google.firebase.firestore.auth.FirebaseAuthCredentialsProvider in project firebase-android-sdk by firebase.
the class FirebaseFirestore method newInstance.
@NonNull
static FirebaseFirestore newInstance(@NonNull Context context, @NonNull FirebaseApp app, @NonNull Deferred<InternalAuthProvider> deferredAuthProvider, @NonNull Deferred<InternalAppCheckTokenProvider> deferredAppCheckTokenProvider, @NonNull String database, @NonNull InstanceRegistry instanceRegistry, @Nullable GrpcMetadataProvider metadataProvider) {
String projectId = app.getOptions().getProjectId();
if (projectId == null) {
throw new IllegalArgumentException("FirebaseOptions.getProjectId() cannot be null");
}
DatabaseId databaseId = DatabaseId.forDatabase(projectId, database);
AsyncQueue queue = new AsyncQueue();
CredentialsProvider<User> authProvider = new FirebaseAuthCredentialsProvider(deferredAuthProvider);
CredentialsProvider<String> appCheckProvider = new FirebaseAppCheckTokenProvider(deferredAppCheckTokenProvider);
// Firestore uses a different database for each app name. Note that we don't use
// app.getPersistenceKey() here because it includes the application ID which is related
// to the project ID. We already include the project ID when resolving the database,
// so there is no need to include it in the persistence key.
String persistenceKey = app.getName();
FirebaseFirestore firestore = new FirebaseFirestore(context, databaseId, persistenceKey, authProvider, appCheckProvider, queue, app, instanceRegistry, metadataProvider);
return firestore;
}
Aggregations