I am following the following github to test authentication on firebase on node.js, https://github.com/hvalls/node-firebase-auth-example
I am getting the firebase.auth() is not a function.
I have tried the following:
- Remove Firebase-admin
- Remove Firebase
- Reinstall Firebase via Npm
I just cant figure out whats wrong.
user_service.js const firebaseapp = require("firebase/app"); require("firebase/auth"); const apiKey = xxxx const fb = firebaseapp.initializeApp({ apiKey: apiKey, }); exports.addUser = (email, password) => fb.auth().createUserWithEmailAndPassword(email, password); exports.authenticate = (email, password) =>{ fb.auth().signInWithEmailAndPassword(email, password); } Route.js
router.post('/now', function (req, res, next){ console.log('Here'); try { const u = userService.authenticate(req.body.email, req.body.password); } catch (error) { console.log("Error : " + error); req.sendStatus(500).send(error); } });