Skip to content

Commit c302702

Browse files
committed
Auth compat index
1 parent b73ab41 commit c302702

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

packages-exp/auth-compat-exp/index.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* limitations under the License.
1616
*/
1717

18-
import firebase from '@firebase/app';
18+
import firebase from '@firebase/app-compat';
1919
import { _FirebaseNamespace } from '@firebase/app-types/private';
2020
import * as impl from '@firebase/auth-exp/internal';
2121
import * as externs from '@firebase/auth-types-exp';
@@ -28,20 +28,22 @@ import {
2828
import { version } from './package.json';
2929
import { Auth } from './src/auth';
3030
import { Persistence } from './src/persistence';
31+
import { _getClientPlatform } from './src/platform';
3132
import { RecaptchaVerifier } from './src/recaptcha_verifier';
3233

3334
const AUTH_TYPE = 'auth';
3435

3536
// Create auth components to register with firebase.
3637
// Provides Auth public APIs.
37-
function registerAuth(instance: _FirebaseNamespace): void {
38+
function registerAuthCompat(instance: _FirebaseNamespace): void {
3839
instance.INTERNAL.registerComponent(
3940
new Component(
4041
AUTH_TYPE,
4142
container => {
4243
// getImmediate for FirebaseApp will always succeed
4344
const app = container.getProvider('app').getImmediate();
44-
return new Auth(app);
45+
const auth = container.getProvider('auth-exp').getImmediate();
46+
return new Auth(app, auth as impl.AuthImpl);
4547
},
4648
ComponentType.PUBLIC
4749
)
@@ -80,4 +82,5 @@ function registerAuth(instance: _FirebaseNamespace): void {
8082
instance.registerVersion('auth', version);
8183
}
8284

83-
registerAuth(firebase as _FirebaseNamespace);
85+
impl.registerAuth(_getClientPlatform());
86+
registerAuthCompat(firebase as _FirebaseNamespace);

0 commit comments

Comments
 (0)