Skip to content

Commit f33dc14

Browse files
committed
Pull auth from service instead of instantiating directly
1 parent 99608da commit f33dc14

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

common/api-review/auth-exp.api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ export class PhoneAuthCredential extends AuthCredential implements externs.Phone
304304

305305
// @public (undocumented)
306306
export class PhoneAuthProvider implements externs.PhoneAuthProvider {
307-
constructor(auth: Auth_2);
307+
constructor(auth: externs.Auth);
308308
// (undocumented)
309309
static credential(verificationId: string, verificationCode: string): PhoneAuthCredential;
310310
// (undocumented)

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ function registerAuthCompat(instance: _FirebaseNamespace): void {
4343
container => {
4444
// getImmediate for FirebaseApp will always succeed
4545
const app = container.getProvider('app').getImmediate();
46-
return new Auth(app);
46+
const auth = container.getProvider('auth-exp').getImmediate();
47+
return new Auth(app, auth as impl.AuthImpl);
4748
},
4849
ComponentType.PUBLIC
4950
)
@@ -82,4 +83,5 @@ function registerAuthCompat(instance: _FirebaseNamespace): void {
8283
instance.registerVersion('auth', version);
8384
}
8485

86+
impl.registerAuth(_getClientPlatform());
8587
registerAuthCompat(firebase as _FirebaseNamespace);

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ import {
3636
import { unwrap, Wrapper } from './wrap';
3737

3838
export class Auth implements compat.FirebaseAuth, Wrapper<externs.Auth> {
39-
private readonly auth: impl.AuthImpl;
39+
// private readonly auth: impl.AuthImpl;
4040

41-
constructor(readonly app: FirebaseApp) {
41+
constructor(readonly app: FirebaseApp, private readonly auth: impl.AuthImpl) {
4242
const { apiKey, authDomain } = app.options;
4343

4444
// TODO(avolkovi): Implement proper persistence fallback
@@ -59,7 +59,7 @@ export class Auth implements compat.FirebaseAuth, Wrapper<externs.Auth> {
5959
sdkClientVersion: impl._getClientVersion(_getClientPlatform())
6060
};
6161

62-
this.auth = new impl.AuthImpl(app, config);
62+
// this.auth = new impl.AuthImpl(app, config);
6363

6464
// This promise is intended to float; auth initialization happens in the
6565
// background, meanwhile the auth object may be used by the app.

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export { Persistence } from '../src/core/persistence';
2828
export { UserImpl } from '../src/core/user/user_impl';
2929
export { _getInstance } from '../src/core/util/instantiator';
3030
export { UserCredential, UserParameters } from '../src/model/user';
31+
export { registerAuth } from '../src/core/auth/register';
3132
export {
3233
DEFAULT_API_HOST,
3334
DEFAULT_API_SCHEME,

0 commit comments

Comments
 (0)