thezohaan thezohaan - 24 days ago 11
Javascript Question

Uncaught SyntaxError: Unexpected token , in refCreateUser in firebase

I see the following error in the console. I am not sure how i can provide both email and password in ref.CreateUser

Uncaught SyntaxError: Unexpected token ,

This is function

function so_passwd() {
var email = $("#so_email").val();
var password = $("#so_pass").val();
ref.createUser({
email,
password
}, function(error) {
if (error === null) {
console.log("User created successfully");
} else {
console.log("Error creating user:", error);
}
});
}

Answer

Shouldn't it be:

function so_passwd(){
    var email = $("#so_email").val();
    var password = $("#so_pass").val();
    ref.createUser({
        "email": email
        "password": password
    }, function(error) {
    if (error === null) {
        console.log("User created successfully");
    } else {
        console.log("Error creating user:", error);
    }
});