UNPKG

1.85 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright 2020 Google LLC
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17import { FirebaseApp } from '@firebase/app';
18import { Auth, Dependencies } from '../../model/public_types';
19import { AuthImpl } from './auth_impl';
20/**
21 * Initializes an {@link Auth} instance with fine-grained control over
22 * {@link Dependencies}.
23 *
24 * @remarks
25 *
26 * This function allows more control over the {@link Auth} instance than
27 * {@link getAuth}. `getAuth` uses platform-specific defaults to supply
28 * the {@link Dependencies}. In general, `getAuth` is the easiest way to
29 * initialize Auth and works for most use cases. Use `initializeAuth` if you
30 * need control over which persistence layer is used, or to minimize bundle
31 * size if you're not using either `signInWithPopup` or `signInWithRedirect`.
32 *
33 * For example, if your app only uses anonymous accounts and you only want
34 * accounts saved for the current session, initialize `Auth` with:
35 *
36 * ```js
37 * const auth = initializeAuth(app, {
38 * persistence: browserSessionPersistence,
39 * popupRedirectResolver: undefined,
40 * });
41 * ```
42 *
43 * @public
44 */
45export declare function initializeAuth(app: FirebaseApp, deps?: Dependencies): Auth;
46export declare function _initializeAuthInstance(auth: AuthImpl, deps?: Dependencies): void;