-
Notifications
You must be signed in to change notification settings - Fork 945
Register auth with the app component. Add the getAuth() methods for each platform #3637
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
28ad6bc
9841c21
1286d5b
2e6a1d0
e646fca
6626c6f
11ef6c9
ff8e00f
fc39589
bcce4a4
107de24
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,10 +15,15 @@ | |
* limitations under the License. | ||
*/ | ||
|
||
import { registerVersion } from '@firebase/app-exp'; | ||
import { name, version } from './package.json'; | ||
import { _initializeAuthForClientPlatform } from './src/core/auth/auth_impl'; | ||
import { FirebaseApp } from '@firebase/app-types-exp'; | ||
import { Auth } from '@firebase/auth-types-exp'; | ||
|
||
import { initializeAuth } from './src'; | ||
import { registerAuth } from './src/core/auth/register'; | ||
import { ClientPlatform } from './src/core/util/version'; | ||
import { browserLocalPersistence } from './src/platform_browser/persistence/browser'; | ||
import { indexedDBLocalPersistence } from './src/platform_browser/persistence/indexed_db'; | ||
import { browserPopupRedirectResolver } from './src/platform_browser/popup_redirect'; | ||
|
||
// Core functionality shared by all clients | ||
export * from './src'; | ||
|
@@ -60,8 +65,11 @@ export { browserPopupRedirectResolver } from './src/platform_browser/popup_redir | |
// MFA | ||
export { PhoneMultiFactorGenerator } from './src/platform_browser/mfa/assertions/phone'; | ||
|
||
export const initializeAuth = _initializeAuthForClientPlatform( | ||
ClientPlatform.BROWSER | ||
); | ||
export function getAuth(app?: FirebaseApp): Auth { | ||
return initializeAuth(app, { | ||
popupRedirectResolver: browserPopupRedirectResolver, | ||
persistence: [indexedDBLocalPersistence, browserLocalPersistence] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why can't we do the same style of fallback for workers? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The "fallback" is doing different things. Here, it's saying "check these persistences in this order," whereas for workers, it's literally checking to see if it's available (if you tried to pass indexedDB into it when it wasn't available, the instantiation would just error out) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wouldn't auth fallback to memory persistence when indexedDB is not available. Why is it different for workers? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently it would error. It probably shouldn't but we need to clarify that separately. For now I'd like to move ahead and deal with that issue in a separate PR. I'm tracking this in b/165376704 |
||
}); | ||
} | ||
|
||
registerVersion(name, version); | ||
registerAuth(ClientPlatform.BROWSER); |
Uh oh!
There was an error while loading. Please reload this page.