@@ -37,6 +37,7 @@ import {
37
37
import { unwrap , Wrapper } from './wrap' ;
38
38
39
39
const PERSISTENCE_KEY = 'persistence' ;
40
+ const _assert : typeof impl . _assert = impl . _assert ;
40
41
41
42
export class Auth
42
43
implements compat . FirebaseAuth , Wrapper < externs . Auth > , _FirebaseService {
@@ -59,10 +60,12 @@ export class Auth
59
60
const hierarchy = persistences . map < impl . Persistence > ( impl . _getInstance ) ;
60
61
61
62
// TODO: platform needs to be determined using heuristics
62
- impl . assertFn ( apiKey , impl . AuthErrorCode . INVALID_API_KEY , {
63
+ _assert ( apiKey , impl . AuthErrorCode . INVALID_API_KEY , {
63
64
appName : app . name
64
65
} ) ;
65
66
67
+ this . auth . _updateErrorMap ( impl . verboseErrorMap ) ;
68
+
66
69
// This promise is intended to float; auth initialization happens in the
67
70
// background, meanwhile the auth object may be used by the app.
68
71
// eslint-disable-next-line @typescript-eslint/no-floating-promises
@@ -128,10 +131,10 @@ export class Auth
128
131
return impl . isSignInWithEmailLink ( this . auth , emailLink ) ;
129
132
}
130
133
async getRedirectResult ( ) : Promise < compat . UserCredential > {
131
- impl . assertFn (
134
+ _assert (
132
135
_isPopupRedirectSupported ( ) ,
136
+ this . auth ,
133
137
impl . AuthErrorCode . OPERATION_NOT_SUPPORTED ,
134
- { appName : this . app . name }
135
138
) ;
136
139
const credential = await impl . getRedirectResult (
137
140
this . auth ,
@@ -201,7 +204,7 @@ export class Auth
201
204
case Persistence . NONE :
202
205
return impl . inMemoryPersistence ;
203
206
default :
204
- return impl . fail ( impl . AuthErrorCode . ARGUMENT_ERROR , {
207
+ return impl . _fail ( impl . AuthErrorCode . ARGUMENT_ERROR , {
205
208
appName : auth . name
206
209
} ) ;
207
210
}
@@ -266,10 +269,10 @@ export class Auth
266
269
async signInWithPopup (
267
270
provider : compat . AuthProvider
268
271
) : Promise < compat . UserCredential > {
269
- impl . assertFn (
272
+ _assert (
270
273
_isPopupRedirectSupported ( ) ,
274
+ this . auth ,
271
275
impl . AuthErrorCode . OPERATION_NOT_SUPPORTED ,
272
- { appName : this . app . name }
273
276
) ;
274
277
return convertCredential (
275
278
this . auth ,
@@ -281,11 +284,10 @@ export class Auth
281
284
) ;
282
285
}
283
286
async signInWithRedirect ( provider : compat . AuthProvider ) : Promise < void > {
284
- impl . assertFn (
287
+ _assert (
285
288
_isPopupRedirectSupported ( ) ,
286
- impl . AuthErrorCode . OPERATION_NOT_SUPPORTED ,
287
- { appName : this . app . name }
288
- ) ;
289
+ this . auth ,
290
+ impl . AuthErrorCode . OPERATION_NOT_SUPPORTED ) ;
289
291
this . savePersistenceForRedirect ( ) ;
290
292
return impl . signInWithRedirect (
291
293
this . auth ,
0 commit comments