Skip to content

Commit

Permalink
remove redundant storage of installationsAuthId
Browse files Browse the repository at this point in the history
  • Loading branch information
DellaBitta committed Oct 31, 2024
1 parent 41382ed commit c6fc558
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 15 deletions.
3 changes: 0 additions & 3 deletions common/api-review/app.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@ export interface FirebaseOptions {

// @public
export interface FirebaseServerApp extends FirebaseApp {
// (undocumented)
readonly installationsAuthToken: string | null;
// (undocumented)
readonly installationsId: string | null;
name: string;
readonly settings: FirebaseServerAppSettings;
Expand Down
9 changes: 0 additions & 9 deletions packages/app/src/firebaseServerApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,6 @@ export class FirebaseServerAppImpl
return this._serverConfig;
}

get installationsAuthToken(): string | null {
this.checkDestroyed();
if (this._serverConfig.installationsAuthToken !== undefined) {
return this._serverConfig.installationsAuthToken;
} else {
return null;
}
}

get installationsId(): string | null {
this.checkDestroyed();
return this._installationsId;
Expand Down
5 changes: 4 additions & 1 deletion packages/app/src/public-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,11 @@ export interface FirebaseServerApp extends FirebaseApp {
*/
readonly settings: FirebaseServerAppSettings;

/**
* The parsed Firebase Installations Id token if a `installationsAuthToken` was provided to
* {@link (initializeServerApp:1) | initializeServerApp()}. Null otherwise.
*/
readonly installationsId: string | null;
readonly installationsAuthToken: string | null;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/installations/src/api/get-token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ export async function getToken(
forceRefresh = false
): Promise<string> {
if (_isFirebaseServerApp(installations.app)) {
if (!installations.app.installationsAuthToken) {
if (!installations.app.settings.installationsAuthToken) {
throw ERROR_FACTORY.create(
ErrorCode.SERVER_APP_MISSING_INSTALLATIONS_AUTH_TOKEN
);
}
return installations.app.installationsAuthToken;
return installations.app.settings.installationsAuthToken;
}
const installationsImpl = installations as FirebaseInstallationsImpl;
await completeInstallationRegistration(installationsImpl);
Expand Down

0 comments on commit c6fc558

Please sign in to comment.