更新时间:2023-11-28 12:38:52
嗯,我不认为方法createUserWithUsernameAndPassword
works,
用这个来代替 createUserWithEmailAndPassword
I'm trying to create user account using Firebase auth in nodejs. It doesn't work and I don't know why. Here's the code and the error generated by nodejs:
var config = {.......}; // i can't share the config
var app = firebase.initializeApp(config);
var db = app.database();
var auth = app.auth();
auth.createUserWithUsernameAndPassword("anemail@gmail.com", "@NewPassWord").then(
function(user){ console.log(user);},
function(error){ console.error(error);}
);
Error generate by NodeJS:
TypeError: Object [object Object] has no method 'createUserWithUsernameAndPassword'
at Object.<anonymous> (/home/antonio/Projects/firebase/app.js:20:6)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:906:3
well, I don't think that the method "createUserWithUsernameAndPassword"
works,
Use this instead createUserWithEmailAndPassword
you used username when firebase use email