Im using firebase with node js and express so I can create a user. when I do so it just give me this user as anonymous on the firebase dashboard and cant use it to login.
This is my code:
var express = require('express');
var router = express.Router();
var firebase = require('firebase');
var admin = require("firebase-admin");
router.post('/', function(req, res, next) {
admin.auth().createUser({
email: req.body.email,
password: req.body.password,
})
.then(function(userRecord) {
var name = req.body.name;
var email = userRecord.email;
var location = req.body.location;
var phone = req.body.phone;
var logo = req.body.logo;
var category = req.body.category;
var facebook = req.body.facebook;
var twitter = req.body.twitter;
var instagram = req.body.instagram;
admin.database().ref('/suppliers/' + userRecord.uid).set({
id: userRecord.uid,
name: name,
email: email,
location: location,
phone: phone,
logo: logo,
category: category,
facebookPage: facebook,
twitterPage: twitter,
instagramPage: instagram
}).then(function(response){
res.send(response);
})
}).catch(function(error) {
console.log("Error creating new user:", error);
res.send(err);
});
});
module.exports = router;
Hey There !
Im using firebase with node js and express so I can create a user. when I do so it just give me this user as anonymous on the firebase dashboard and cant use it to login.
This is my code: