Skip to content

Commit 120c854

Browse files
authored
fix(auth): addressing observable errors in non-browser environments (#2626)
1 parent 082c0de commit 120c854

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/auth/auth.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Injectable, Inject, Optional, NgZone, PLATFORM_ID } from '@angular/core';
22
import { Observable, of, from } from 'rxjs';
3-
import { switchMap, map, observeOn, shareReplay, first, tap } from 'rxjs/operators';
3+
import { switchMap, map, observeOn, shareReplay, first } from 'rxjs/operators';
44
import {
55
FIREBASE_OPTIONS,
66
FIREBASE_APP_NAME,
@@ -76,13 +76,13 @@ export class AngularFireAuth {
7676
const _ = auth.pipe(first()).subscribe();
7777

7878
this.authState = auth.pipe(
79-
switchMap(auth => auth.getRedirectResult().then(() => auth)),
79+
switchMap(auth => auth.getRedirectResult().then(() => auth, () => auth)),
8080
switchMap(auth => zone.runOutsideAngular(() => new Observable<firebase.User|null>(auth.onAuthStateChanged.bind(auth)))),
8181
keepUnstableUntilFirst
8282
);
8383

8484
this.user = auth.pipe(
85-
switchMap(auth => auth.getRedirectResult().then(() => auth)),
85+
switchMap(auth => auth.getRedirectResult().then(() => auth, () => auth)),
8686
switchMap(auth => zone.runOutsideAngular(() => new Observable<firebase.User|null>(auth.onIdTokenChanged.bind(auth)))),
8787
keepUnstableUntilFirst
8888
);

0 commit comments

Comments
 (0)