firebase / firebase-js-sdk

Firebase Javascript SDK
https://firebase.google.com/docs/web/setup
Other
4.82k stars 884 forks source link

Config interface should have all properties readonly #7589

Open marcusx2 opened 1 year ago

marcusx2 commented 1 year ago

Operating System

macOS

Browser Version

Safari 16.5.2

Firebase SDK Version

10.1.0

Firebase SDK Product:

Auth

Describe your project's tooling

index.html with source tag.

Describe the problem

I am talking about this interface

export interface Config {
  /**
   * The API Key used to communicate with the Firebase Auth backend.
   */
  apiKey: string;
  /**
   * The host at which the Firebase Auth backend is running.
   */
  apiHost: string;
  /**
   * The scheme used to communicate with the Firebase Auth backend.
   */
  apiScheme: string;
  /**
   * The host at which the Secure Token API is running.
   */
  tokenApiHost: string;
  /**
   * The SDK Client Version.
   */
  sdkClientVersion: string;
  /**
   * The domain at which the web widgets are hosted (provided via Firebase Config).
   */
  authDomain?: string;
}

I think the fact that the properties are not readonly is an oversight. These properties don't seem to be supposed to be changeable after an auth instance is fetched. The EmulatorConfig interface, also used by the Auth interface, has all of its properties set to readonly.

Steps and code to reproduce issue

const auth = getAuth();
auth.config.apiKey = "blablabla";//I don't think this is intended to be possible
bhparijat commented 11 months ago

Hi, This will be a breaking change for us and we will revisit it when we are working on v11. Thanks