Skip to content

Commit

Permalink
Removed emulator provider
Browse files Browse the repository at this point in the history
  • Loading branch information
maneesht committed May 9, 2024
1 parent 323fdc1 commit ed9123d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 28 deletions.
5 changes: 1 addition & 4 deletions packages/data-connect/src/api/DataConnect.ts
Expand Up @@ -26,7 +26,6 @@ import { Provider } from '@firebase/component';

import {
AuthTokenProvider,
EmulatorTokenProvider,
FirebaseAuthProvider
} from '../core/FirebaseAuthProvider';
import { QueryManager } from '../core/QueryManager';
Expand Down Expand Up @@ -124,9 +123,7 @@ export class DataConnect {
}

if (this.authProvider) {
this.authTokenProvider = this.isEmulator
? new EmulatorTokenProvider(EmulatorTokenProvider.OWNER)
: new FirebaseAuthProvider(
this.authTokenProvider = new FirebaseAuthProvider(
this.app.name,
this.app.options,
this.authProvider
Expand Down
24 changes: 0 additions & 24 deletions packages/database/src/core/AuthTokenProvider.ts
Expand Up @@ -120,27 +120,3 @@ export class FirebaseAuthTokenProvider implements AuthTokenProvider {
warn(errorMessage);
}
}

/* AuthTokenProvider that supplies a constant token. Used by Admin SDK or mockUserToken with emulators. */
export class EmulatorTokenProvider implements AuthTokenProvider {
/** A string that is treated as an admin access token by the RTDB emulator. Used by Admin SDK. */
static OWNER = 'owner';

constructor(private accessToken: string) {}

getToken(forceRefresh: boolean): Promise<FirebaseAuthTokenData> {
return Promise.resolve({
accessToken: this.accessToken
});
}

addTokenChangeListener(listener: (token: string | null) => void): void {
// Invoke the listener immediately to match the behavior in Firebase Auth
// (see packages/auth/src/auth.js#L1807)
listener(this.accessToken);
}

removeTokenChangeListener(listener: (token: string | null) => void): void {}

notifyForInvalidToken(): void {}
}

0 comments on commit ed9123d

Please sign in to comment.