Skip to content

feat(Auth): Web-Worker friendly Authentication #68

@jeffbcross

Description

@jeffbcross

Since first-class third-party oauth methods (Facebook, Github, Twitter, Google) require a popup window or redirect, they don't play very nicely with Web Workers where neither popups or redirects are possible without some communication with the UI thread...because there's no window object, and the location object is more-or-less read only and doesn't represent the same thing as in the UI thread.

So, after some deliberation with @jteplitz602 looking at the options, the option that seems most doable in the meantime is to have a way to keep the Firebase SDK in the UI thread, and proxy messages back and forth with the Web Worker.

So for users using Web Worker, they will:

  • Use WORKER_RENDER_PROVIDERS in the main thread.
  • Use WORKER_APP_PROVIDERS in the worker.
  • The Firebase SDK will NOT be able to be directly used in the worker, so the application will be limited to whatever features AngularFire supports. (They could technically use it, but it will be a terrible experience with out-of-sync data between contexts).

This will have some performance impact from marshaling data from UI -> Worker -> UI, but this is not expected to be significant.

The longer term plan would be to work with Firebase team to add better support for this use case in the SDK.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions