Adding Firebase as an AuthClient

Hello people \o/

I’m biting to @thedavid’s invitation to work with the community on Firebase’s support.

So far it seems rather straight forward, so… here’d be my PR:

I’d need guidance on the types ( Typescript isn’t my game ) and feedback would be appreciated, the proposal is rudimentary but still, I may have missed some interesting points.

This being said there’d be matters to discuss:

  • Firebase needs to be initialized, I’d propose to make it happen in src/index.js:
    var config = {
      apiKey: '###somekey',
      authDomain: '',
      databaseURL: '',
      projectId: 'anonymousapp',
      storageBucket: '',
      messagingSenderId: '181173933586',
      appId: '###yourownappId',

    const firebaseClient = ((config) => {
      return firebase

      <FatalErrorBoundary page={FatalErrorPage}>
        <AuthProvider client={firebaseClient} type={'firebase'}>
            <MuiThemeProvider theme={theme}>
              <App />
  • Firebase offers plenty of different ways to sign in, I have privileged de facto the Google Auth provider with the signInWithRedirect. What should we do? Should we support more of its methods or keep it very Google focused?

  • Last but not least there’s a great FirebaseUI package, I had worked with it during my personal researches on my RW project but I didn’t give a try for 0.7.0 Auth package. What’s the community’s opinion on this?

Thanks for any feedback :slight_smile:



I forgot one more thing: User retrieved in currentUser is the raw version from firebase with plenty of useless keys, we can narrow them down to its 6 relevant keys ( displayName, email, uid, providerId, phoneNumber, photoUrl ) - and even remove providerId.

Excited you’re taking this on @noire.munich :star_struck: And thank you for opening up the approach to community discussion here. Now that you also have a PR in progress, don’t hesitate to focus (and move) more of the discussion to the GitHub PR. It will be easier that way for @peterp (who’s our resident AuthMaster™ :wink:) to follow along and help with input. Either way, just make sure to ping us – we definitely want to see this happen!

FYI: all my 2¢ below with the caveat I have no experience with Firebase.

1. Firebase Initialization
Agreed about index.js That’s aligned with current approaches in the RW Auth doc.

2. Identity Providers
Is this the correct list of OAuth identity providers?

Given this is a Google product, I think having Google Auth as a default could be expected behavior (we won’t know until people start using it, of course). But, since this is an important step in the process, I think it might also be reasonable to discuss:

  • if best to have no default and require setup intentionally
  • either way, how to ensure this is easy to manage/config and that any default configuration is exposed/obvious

3. FirebaseUI
Without this, is there any UI available? If not, I’d vote it should be included (but not so entangled it can’t be removed). But if there is a basic, working UI without it, I’d vote to make it an optional step with documented instructions and any required config ready-to-go for easy plug-n-play.

4. Documentation
Just a reminder to include updating the Authentication documentation along with this PR! We :heart: docs and are happy to help out as needed – just let us know.

5. RW Auth Generator
As a second step, we should consider how/when this gets yarn rw g auth firebase support. Ideally it would be included soon after closing this PR!


Ok, I answered in the PR :wink:
also this morning I posted my fix and now it passes the tests, seems to work on both workspaces.
I think there’s something missing in the doc, the client type should be declared also in authHeaders.ts because by default, decodeAuthToken which is used on the API side will throw an exception.
It seems to be missing here:
Fixed in my PR this way:
I had to implement the decoding in the api/src/lib/auth.js because the server side client with firebase is not the same as the client side - I’ll update some doc for review, in the PR, to further discuss this issue.