Skip to content
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

Firebase npm "^9.x" support #145

Open
andrewpalkin opened this issue May 22, 2022 · 2 comments
Open

Firebase npm "^9.x" support #145

andrewpalkin opened this issue May 22, 2022 · 2 comments

Comments

@andrewpalkin
Copy link

Is your feature request related to a problem? Please describe.
Are you thinking about to support the new package of firebase (version 9+)

Describe the solution you'd like
As an expected please support of new firebase package

Describe alternatives you've considered
As alternative the firebase package already provide the ability (developed by their-self ) of authentication service

@fotoflo
Copy link

fotoflo commented May 28, 2022

Just chiming in here cause I'm hoping for an easy upgrade path

@brownieboy
Copy link

brownieboy commented Oct 6, 2022

For Firebase 9, you should be able to use the /app/ compatibility imports as a short term workaround, e.g.

import firebase from "firebase/compat/app";
import "firebase/compat/auth";
import "firebase/compat/database";
import "firebase/compat/storage";

and so on. Then it should all work the same as for Firebase 8.

Full Firebase 9 support looks to be a hefty rewrite though. There are no more "give me everything" import statements. You have to import just what you need now.

I managed to get an example app to build my changing my code like so:

import {initializeApp} from "firebase/app";
import {getAuth, GoogleAuthProvider, GithubAuthProvider, TwitterAuthProvider, FacebookAuthProvider} from "firebase/auth";
import "firebase/database";
import withFirebaseAuth from "react-with-firebase-auth";

// You must supply this!
import firebaseConfigObj from "./firebaseconfig/firebase-config.json";
const firebaseApp = initializeApp(firebaseConfigObj);
const firebaseAppAuth = getAuth();

const providers = {
  googleProvider: new GoogleAuthProvider(),
  githubProvider: new GithubAuthProvider(),
  twitterProvider: new TwitterAuthProvider(),
  facebookProvider: new FacebookAuthProvider()
};

const App = props => {
// app component here
};

export default withFirebaseAuth({
  providers,
  firebaseAppAuth
})(App);

But it didn't actually work to log me in. It returned this error:

firebaseAppAuth.signInWithEmailAndPassword is not a function

which, indeed, it isn't now. With Firebase 9 you would have to import that function in directly too:

import {signInWithEmailAndPassword} from "firebase/auth";

And that's deep in the library code, sadly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants