diff --git a/common/api-review/app.api.md b/common/api-review/app.api.md index 538adc36471..e226940ef1b 100644 --- a/common/api-review/app.api.md +++ b/common/api-review/app.api.md @@ -73,7 +73,6 @@ export interface FirebaseOptions { // @public export interface FirebaseServerApp extends FirebaseApp { - authIdTokenVerified: () => Promise; name: string; readonly settings: FirebaseServerAppSettings; } diff --git a/docs-devsite/app.firebaseserverapp.md b/docs-devsite/app.firebaseserverapp.md index ba8680883c2..66b51c45fb2 100644 --- a/docs-devsite/app.firebaseserverapp.md +++ b/docs-devsite/app.firebaseserverapp.md @@ -25,24 +25,9 @@ export interface FirebaseServerApp extends FirebaseApp | Property | Type | Description | | --- | --- | --- | -| [authIdTokenVerified](./app.firebaseserverapp.md#firebaseserverappauthidtokenverified) | () => Promise<void> | Checks to see if the local verification of the authIdToken provided to [initializeServerApp()](./app.md#initializeserverapp_30ab697) has completed.It is recommend that your application awaits this Promise before invoking getAuth if an authIdToken was provided in the FirebaseServerAppSettings.The returned Promise is completed immediately if the optional authIdToken parameter was omitted from FirebaseServerApp initialization. | | [name](./app.firebaseserverapp.md#firebaseserverappname) | string | There is no getApp() operation for FirebaseServerApp, so the name is not relevant for applications. However, it may be used internally, and is declared here so that FirebaseServerApp conforms to the FirebaseApp interface. | | [settings](./app.firebaseserverapp.md#firebaseserverappsettings) | [FirebaseServerAppSettings](./app.firebaseserverappsettings.md#firebaseserverappsettings_interface) | The (read-only) configuration settings for this server app. These are the original parameters given in [initializeServerApp()](./app.md#initializeserverapp_30ab697). | -## FirebaseServerApp.authIdTokenVerified - -Checks to see if the local verification of the `authIdToken` provided to [initializeServerApp()](./app.md#initializeserverapp_30ab697) has completed. - -It is recommend that your application awaits this `Promise` before invoking `getAuth` if an `authIdToken` was provided in the `FirebaseServerAppSettings`. - -The returned `Promise` is completed immediately if the optional `authIdToken` parameter was omitted from `FirebaseServerApp` initialization. - -Signature: - -```typescript -authIdTokenVerified: () => Promise; -``` - ## FirebaseServerApp.name There is no `getApp()` operation for `FirebaseServerApp`, so the name is not relevant for applications. However, it may be used internally, and is declared here so that `FirebaseServerApp` conforms to the `FirebaseApp` interface. diff --git a/docs-devsite/app.firebaseserverappsettings.md b/docs-devsite/app.firebaseserverappsettings.md index 32e74fa31e2..20c335b04a6 100644 --- a/docs-devsite/app.firebaseserverappsettings.md +++ b/docs-devsite/app.firebaseserverappsettings.md @@ -23,7 +23,7 @@ export interface FirebaseServerAppSettings extends FirebaseAppSettings | Property | Type | Description | | --- | --- | --- | -| [authIdToken](./app.firebaseserverappsettings.md#firebaseserverappsettingsauthidtoken) | string | An optional Auth ID token used to resume a signed in user session from a client runtime environment.If provided, the FirebaseServerApp works to validate the token even before Auth is initialized. The result of the validation can be queried via . Awaiting the Promise returned by is highly recommended if an authIdToken token is provided.Invoking getAuth with a FirebaseServerApp configured with a validated authIdToken causes an automatic attempt to sign in the user that the authIdToken represents. The token needs to have been recently minted for this operation to succeed.If the token fails local verification, or if the Auth service has failed to validate it when the Auth SDK is initialized, then a warning is logged to the console and the Auth SDK will not sign in a user on initalization.If a user is successfully signed in, then the Auth instance's onAuthStateChanged callback is invoked with the User object as per standard Auth flows. However, User objects created via an authIdToken do not have a refresh token. Attempted refreshToken operations fail. | +| [authIdToken](./app.firebaseserverappsettings.md#firebaseserverappsettingsauthidtoken) | string | An optional Auth ID token used to resume a signed in user session from a client runtime environment.Invoking getAuth with a FirebaseServerApp configured with a validated authIdToken causes an automatic attempt to sign in the user that the authIdToken represents. The token needs to have been recently minted for this operation to succeed.If the token fails local verification, or if the Auth service has failed to validate it when the Auth SDK is initialized, then a warning is logged to the console and the Auth SDK will not sign in a user on initalization.If a user is successfully signed in, then the Auth instance's onAuthStateChanged callback is invoked with the User object as per standard Auth flows. However, User objects created via an authIdToken do not have a refresh token. Attempted refreshToken operations fail. | | [name](./app.firebaseserverappsettings.md#firebaseserverappsettingsname) | undefined | There is no getApp() operation for FirebaseServerApp, so the name is not relevant for applications. However, it may be used internally, and is declared here so that FirebaseServerApp conforms to the FirebaseApp interface. | | [releaseOnDeref](./app.firebaseserverappsettings.md#firebaseserverappsettingsreleaseonderef) | object | An optional object. If provided, the Firebase SDK uses a FinalizationRegistry object to monitor the garbage collection status of the provided object. The Firebase SDK releases its reference on the FirebaseServerApp instance when the provided releaseOnDeref object is garbage collected.You can use this field to reduce memory management overhead for your application. If provided, an app running in a SSR pass does not need to perform FirebaseServerApp cleanup, so long as the reference object is deleted (by falling out of SSR scope, for instance.)If an object is not provided then the application must clean up the FirebaseServerApp instance by invoking deleteApp.If the application provides an object in this parameter, but the application is executed in a JavaScript engine that predates the support of FinalizationRegistry (introduced in node v14.6.0, for instance), then an error is thrown at FirebaseServerApp initialization. | @@ -31,8 +31,6 @@ export interface FirebaseServerAppSettings extends FirebaseAppSettings An optional Auth ID token used to resume a signed in user session from a client runtime environment. -If provided, the `FirebaseServerApp` works to validate the token even before `Auth` is initialized. The result of the validation can be queried via . Awaiting the `Promise` returned by is highly recommended if an `authIdToken` token is provided. - Invoking `getAuth` with a `FirebaseServerApp` configured with a validated `authIdToken` causes an automatic attempt to sign in the user that the `authIdToken` represents. The token needs to have been recently minted for this operation to succeed. If the token fails local verification, or if the Auth service has failed to validate it when the Auth SDK is initialized, then a warning is logged to the console and the Auth SDK will not sign in a user on initalization. diff --git a/packages/app/src/firebaseServerApp.test.ts b/packages/app/src/firebaseServerApp.test.ts index c31d603b0e1..408b5f09922 100644 --- a/packages/app/src/firebaseServerApp.test.ts +++ b/packages/app/src/firebaseServerApp.test.ts @@ -130,11 +130,9 @@ describe('FirebaseServerApp', () => { new ComponentContainer('test') ); - expect(() => app.authIdTokenVerified).to.not.throw(); + expect(() => app.settings).to.not.throw(); (app as unknown as FirebaseServerAppImpl).isDeleted = true; - expect(() => app.authIdTokenVerified()).throws( - 'Firebase Server App has been deleted' - ); + expect(() => app.settings).throws('Firebase Server App has been deleted'); }); }); diff --git a/packages/app/src/firebaseServerApp.ts b/packages/app/src/firebaseServerApp.ts index a94dc7bd760..6f72b10fea0 100644 --- a/packages/app/src/firebaseServerApp.ts +++ b/packages/app/src/firebaseServerApp.ts @@ -115,12 +115,6 @@ export class FirebaseServerAppImpl return this._serverConfig; } - authIdTokenVerified(): Promise { - this.checkDestroyed(); - // TODO - return Promise.resolve(); - } - /** * This function will throw an Error if the App has already been deleted - * use before performing API actions on the App. diff --git a/packages/app/src/internal.ts b/packages/app/src/internal.ts index f266de95166..7e0c1545962 100644 --- a/packages/app/src/internal.ts +++ b/packages/app/src/internal.ts @@ -170,7 +170,7 @@ export function _isFirebaseApp( export function _isFirebaseServerApp( obj: FirebaseApp | FirebaseServerApp ): obj is FirebaseServerApp { - return (obj as FirebaseServerApp).authIdTokenVerified !== undefined; + return (obj as FirebaseServerApp).settings !== undefined; } /** diff --git a/packages/app/src/public-types.ts b/packages/app/src/public-types.ts index a1c2aed69a9..ad2b441933a 100644 --- a/packages/app/src/public-types.ts +++ b/packages/app/src/public-types.ts @@ -82,18 +82,6 @@ export interface FirebaseApp { * @public */ export interface FirebaseServerApp extends FirebaseApp { - /** - * Checks to see if the local verification of the `authIdToken` provided to - * {@link (initializeServerApp:1) | initializeServerApp()} has completed. - * - * It is recommend that your application awaits this `Promise` before invoking `getAuth` if an - * `authIdToken` was provided in the `FirebaseServerAppSettings`. - * - * The returned `Promise` is completed immediately if the optional `authIdToken` parameter - * was omitted from `FirebaseServerApp` initialization. - */ - authIdTokenVerified: () => Promise; - /** * There is no `getApp()` operation for `FirebaseServerApp`, so the name is not relevant for * applications. However, it may be used internally, and is declared here so that @@ -192,12 +180,6 @@ export interface FirebaseServerAppSettings extends FirebaseAppSettings { * An optional Auth ID token used to resume a signed in user session from a client * runtime environment. * - * If provided, the `FirebaseServerApp` works to validate the token even before - * `Auth` is initialized. The result of the validation can be queried via - * {@link (FirebaseServerApp.authIdTokenVerified()}. Awaiting the `Promise` returned by - * {@link (FirebaseServerApp.authIdTokenVerified()} is highly recommended if an `authIdToken` - * token is provided. - * * Invoking `getAuth` with a `FirebaseServerApp` configured with a validated `authIdToken` * causes an automatic attempt to sign in the user that the `authIdToken` represents. The token * needs to have been recently minted for this operation to succeed.