|
| 1 | +/** |
| 2 | + * @license |
| 3 | + * Copyright 2021 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 | + */ |
| 17 | + |
| 18 | +/** |
| 19 | + * This is the file that people using Cordova will actually import. You |
| 20 | + * should only include this file if you have something specific about your |
| 21 | + * implementation that mandates having a separate entrypoint. Otherwise you can |
| 22 | + * just use index.ts |
| 23 | + */ |
| 24 | + |
| 25 | +import { FirebaseApp } from '@firebase/app-types-exp'; |
| 26 | +import { Auth } from '@firebase/auth-types-exp'; |
| 27 | +import { indexedDBLocalPersistence } from './src/platform_browser/persistence/indexed_db'; |
| 28 | + |
| 29 | +import { initializeAuth } from './src'; |
| 30 | +import { registerAuth } from './src/core/auth/register'; |
| 31 | +import { ClientPlatform } from './src/core/util/version'; |
| 32 | + |
| 33 | +// Core functionality shared by all clients |
| 34 | +export * from './src'; |
| 35 | + |
| 36 | +// Cordova also supports indexedDB / browserSession / browserLocal |
| 37 | +export { indexedDBLocalPersistence } from './src/platform_browser/persistence/indexed_db'; |
| 38 | +export { browserLocalPersistence } from './src/platform_browser/persistence/local_storage'; |
| 39 | +export { browserSessionPersistence } from './src/platform_browser/persistence/session_storage'; |
| 40 | + |
| 41 | +export { cordovaPopupRedirectResolver } from './src/platform_cordova/popup_redirect'; |
| 42 | +export { signInWithRedirect } from './src/platform_cordova/strategies/redirect'; |
| 43 | + |
| 44 | +import { cordovaPopupRedirectResolver } from './src/platform_cordova/popup_redirect'; |
| 45 | + |
| 46 | +export function getAuth(app: FirebaseApp): Auth { |
| 47 | + return initializeAuth(app, { |
| 48 | + persistence: indexedDBLocalPersistence, |
| 49 | + popupRedirectResolver: cordovaPopupRedirectResolver |
| 50 | + }); |
| 51 | +} |
| 52 | + |
| 53 | +registerAuth(ClientPlatform.CORDOVA); |
0 commit comments