Skip to content

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

Merged
merged 11 commits into from
Aug 24, 2020

Conversation

sam-gc
Copy link
Contributor

@sam-gc sam-gc commented Aug 14, 2020

No description provided.

@changeset-bot
Copy link

changeset-bot bot commented Aug 14, 2020

💥 No Changeset

Latest commit: 107de24

Merging this PR will not cause any packages to be released. If these changes should not cause updates to packages in this repo, this is fine 🙂

If these changes should be published to npm, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Aug 14, 2020

Binary Size Report

Affected SDKs

No changes between base commit (55d3c26) and head commit (487c6f1).

Test Logs

export function getAuth(app?: FirebaseApp): Auth {
return initializeAuth(app, {
popupRedirectResolver: browserPopupRedirectResolver,
persistence: [indexedDBLocalPersistence, browserLocalPersistence]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why can't we do the same style of fallback for workers?

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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)

Copy link
Member

Choose a reason for hiding this comment

The 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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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

export function getAuth(app?: FirebaseApp): Auth {
return initializeAuth(app, {
popupRedirectResolver: browserPopupRedirectResolver,
persistence: [indexedDBLocalPersistence, browserLocalPersistence]
Copy link
Member

Choose a reason for hiding this comment

The 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?

@@ -54,6 +54,8 @@ export function signOut(auth: externs.Auth): Promise<void> {
return auth.signOut();
}

export { initializeAuth } from './auth/initialize';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the entry point for it? @firebase/auth/core?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No entry point for it, it's only used as a building block for the other entry points

Copy link
Member

@Feiyang1 Feiyang1 Aug 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

initializeAuth is a public API in the original proposal, which allows people to configure things, e.g. persistence and resolvers. Has that changed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. It's just the way our exports go:

src/core/index.ts re-exports all of the things in core
src/index.ts just does export * from './core';
index.ts does export * from './src'; as well as the browser-specific APIs

@sam-gc sam-gc merged commit c7ef26f into auth-next Aug 24, 2020
@sam-gc sam-gc deleted the samgho/register-internal branch August 24, 2020 18:26
sam-gc added a commit that referenced this pull request Sep 1, 2020
…ach platform (#3637)

* Register auth with the app component. Add the getAuth() methods for each platform

* Add getAuth for webworker build

* Formatting

* Make firebase auth implement _FirebaseService interface

* Formatting

* Fix tests

* Formatting

* PR feedback

* Formatting

* PR feedback

* Formatting
@firebase firebase locked and limited conversation to collaborators Sep 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants