app.post("/signIn", function (req, res) {

    console.log(req.body.email, req.body.password);

    ref.authWithPassword({
        "email": req.body.email,
        "password": req.body.password
    }, function (error, authData) {
        if (error) {
            console.log("Login Failed!", error);
            res.status(401);
            res.send("signin failed");
        } else {
            //  console.log("Authenticated successfully with payload:", authData);
            //res.send("this is authData", authData);
            userModel.findOne({uid: authData.uid}, function (err, record) {
                if (err) {
                    console.log("Error in finding User", err);

                } else {
                    res.json({
                        success: true, "msg": "data Recieved", record: record
                        // uid: req.body.uid
                    });
                    //   console.log("sucessfully user model & record is ", record);
                }
            });
        }
    });
});
Пример #2
0
  run(gameMasterInfo) {
    this.rootRef = new Firebase('https://2nqujjklgij2gg6v.firebaseio.com/')
    this.rootRef.authWithPassword(
      gameMasterInfo,
      (error, authData) => {
        if (error) {
          console.error('Login failed!', error)
          return
        }
        console.log('Authenticated successfully')

        this.resetGame()
        this.startWatching()
      })
  }