Get the succes login and being redirect with node js Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Error: Can't set headers after they are sent after tried to loginHow do I get started with Node.jsHow to get GET (query string) variables in Express.js on Node.js?How to uninstall npm modules in node js?Firebase Array or Object - How to get child data or check if data existFirebase authentication successful but returns a null user (Web)Firebase WEB - Email Verification not being sent. What's wrong with the codeUndefined _id populate with express, moongose/MongoDB on NodejsIonic firebase Login issueExpress req.body not WorkingLaravel 5.6 - Using built in Auth on custom table - Not authenticating user/password

How would a mousetrap for use in space work?

How can I reduce the gap between left and right of cdot with a macro?

What is this clumpy 20-30cm high yellow-flowered plant?

Central Vacuuming: Is it worth it, and how does it compare to normal vacuuming?

How much damage would a cupful of neutron star matter do to the Earth?

Can anything be seen from the center of the Boötes void? How dark would it be?

Is CEO the "profession" with the most psychopaths?

An adverb for when you're not exaggerating

Why weren't discrete x86 CPUs ever used in game hardware?

Has negative voting ever been officially implemented in elections, or seriously proposed, or even studied?

Is grep documentation about ignoring case wrong, since it doesn't ignore case in filenames?

Maximum summed subsequences with non-adjacent items

How does light 'choose' between wave and particle behaviour?

Do wooden building fires get hotter than 600°C?

What would you call this weird metallic apparatus that allows you to lift people?

How to write this math term? with cases it isn't working

Is there hard evidence that the grant peer review system performs significantly better than random?

How to compare two different files line by line in unix?

Why do we bend a book to keep it straight?

Is there a kind of relay that only consumes power when switching?

How does Python know the values already stored in its memory?

Illegal assignment from sObject to Id

Significance of Cersei's obsession with elephants?

How do I use the new nonlinear finite element in Mathematica 12 for this equation?



Get the succes login and being redirect with node js



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern)
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!Error: Can't set headers after they are sent after tried to loginHow do I get started with Node.jsHow to get GET (query string) variables in Express.js on Node.js?How to uninstall npm modules in node js?Firebase Array or Object - How to get child data or check if data existFirebase authentication successful but returns a null user (Web)Firebase WEB - Email Verification not being sent. What's wrong with the codeUndefined _id populate with express, moongose/MongoDB on NodejsIonic firebase Login issueExpress req.body not WorkingLaravel 5.6 - Using built in Auth on custom table - Not authenticating user/password



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I've been working on a node project and everything is new to me.



So far, scraping the internet I managed to get the user logged in, but now, I don't know hot to direct to the user page once the login process succed.



In the index.js I have:



const userService = require('./auth');

app.post('/login', function(req, res)

var userEmail = req.body.emailLogin;
var userPassword = req.body.passwordLogin;
console.log(userEmail, userPassword); //This log the email and the password

userService.loginUser(emailRegister, passwordRegister,

function(error, authData)

if (error)
return res.status(401).send('Unauthorized');

else
res.render('user');

);
);


and in the auth.js



function loginUser(email, password)
console.log(email, password);
firebase.auth().signInWithEmailAndPassword(email, password)
.then(function(firebaseUser)
// Success
console.log('Ok, lovelly I'm logged');
return firebaseUser
)
.catch(function(error)
// Error Handling
var errorCode = error.code;
var errorMessage = error.message;
console.log(errorCode); //auth/user-not-found
console.log(errorMessage); //There is no user record corresponding to this identifier. The user may have been deleted.

return errorMessage
);



how can I return the firebaseUser to the main function and be redirect to the user page?










share|improve this question






















  • What is emailRegister & passwordRegister where did it come from?

    – Kiran Mathew Mohan
    Mar 22 at 11:00

















0















I've been working on a node project and everything is new to me.



So far, scraping the internet I managed to get the user logged in, but now, I don't know hot to direct to the user page once the login process succed.



In the index.js I have:



const userService = require('./auth');

app.post('/login', function(req, res)

var userEmail = req.body.emailLogin;
var userPassword = req.body.passwordLogin;
console.log(userEmail, userPassword); //This log the email and the password

userService.loginUser(emailRegister, passwordRegister,

function(error, authData)

if (error)
return res.status(401).send('Unauthorized');

else
res.render('user');

);
);


and in the auth.js



function loginUser(email, password)
console.log(email, password);
firebase.auth().signInWithEmailAndPassword(email, password)
.then(function(firebaseUser)
// Success
console.log('Ok, lovelly I'm logged');
return firebaseUser
)
.catch(function(error)
// Error Handling
var errorCode = error.code;
var errorMessage = error.message;
console.log(errorCode); //auth/user-not-found
console.log(errorMessage); //There is no user record corresponding to this identifier. The user may have been deleted.

return errorMessage
);



how can I return the firebaseUser to the main function and be redirect to the user page?










share|improve this question






















  • What is emailRegister & passwordRegister where did it come from?

    – Kiran Mathew Mohan
    Mar 22 at 11:00













0












0








0








I've been working on a node project and everything is new to me.



So far, scraping the internet I managed to get the user logged in, but now, I don't know hot to direct to the user page once the login process succed.



In the index.js I have:



const userService = require('./auth');

app.post('/login', function(req, res)

var userEmail = req.body.emailLogin;
var userPassword = req.body.passwordLogin;
console.log(userEmail, userPassword); //This log the email and the password

userService.loginUser(emailRegister, passwordRegister,

function(error, authData)

if (error)
return res.status(401).send('Unauthorized');

else
res.render('user');

);
);


and in the auth.js



function loginUser(email, password)
console.log(email, password);
firebase.auth().signInWithEmailAndPassword(email, password)
.then(function(firebaseUser)
// Success
console.log('Ok, lovelly I'm logged');
return firebaseUser
)
.catch(function(error)
// Error Handling
var errorCode = error.code;
var errorMessage = error.message;
console.log(errorCode); //auth/user-not-found
console.log(errorMessage); //There is no user record corresponding to this identifier. The user may have been deleted.

return errorMessage
);



how can I return the firebaseUser to the main function and be redirect to the user page?










share|improve this question














I've been working on a node project and everything is new to me.



So far, scraping the internet I managed to get the user logged in, but now, I don't know hot to direct to the user page once the login process succed.



In the index.js I have:



const userService = require('./auth');

app.post('/login', function(req, res)

var userEmail = req.body.emailLogin;
var userPassword = req.body.passwordLogin;
console.log(userEmail, userPassword); //This log the email and the password

userService.loginUser(emailRegister, passwordRegister,

function(error, authData)

if (error)
return res.status(401).send('Unauthorized');

else
res.render('user');

);
);


and in the auth.js



function loginUser(email, password)
console.log(email, password);
firebase.auth().signInWithEmailAndPassword(email, password)
.then(function(firebaseUser)
// Success
console.log('Ok, lovelly I'm logged');
return firebaseUser
)
.catch(function(error)
// Error Handling
var errorCode = error.code;
var errorMessage = error.message;
console.log(errorCode); //auth/user-not-found
console.log(errorMessage); //There is no user record corresponding to this identifier. The user may have been deleted.

return errorMessage
);



how can I return the firebaseUser to the main function and be redirect to the user page?







node.js firebase express authentication






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 22 at 10:33









alessandro buffolialessandro buffoli

8619




8619












  • What is emailRegister & passwordRegister where did it come from?

    – Kiran Mathew Mohan
    Mar 22 at 11:00

















  • What is emailRegister & passwordRegister where did it come from?

    – Kiran Mathew Mohan
    Mar 22 at 11:00
















What is emailRegister & passwordRegister where did it come from?

– Kiran Mathew Mohan
Mar 22 at 11:00





What is emailRegister & passwordRegister where did it come from?

– Kiran Mathew Mohan
Mar 22 at 11:00












2 Answers
2






active

oldest

votes


















1














You have written your code in pre-ES6 standards using concept of callbacks



const userService = require("./auth");

app.post("/login", function(req, res)
var userEmail = req.body.emailLogin;
var userPassword = req.body.passwordLogin;
console.log(userEmail, userPassword); //This log the email and the password

userService.loginUser(
userEmail,
userPassword,

function(error, authData)
if (error)
return res.status(401).send("Unauthorized");
else
res.render("user");


);
);


But you forgot to include the callback argument in login user method and once login user method is successful call callback(null, result) and if its an error call callback(error).



function loginUser(email, password, callback) 
console.log(email, password);
firebase
.auth()
.signInWithEmailAndPassword(email, password)
.then(function(firebaseUser)
// Success
console.log("Ok, lovelly I'm logged");
callback(null, firebaseUser);
)
.catch(function(error)
// Error Handling
var errorCode = error.code;
var errorMessage = error.message;
console.log(errorCode); //auth/user-not-found
console.log(errorMessage); //There is no user record corresponding to this identifier. The user may have been deleted.

callback(error);
);



I have rewritten the code using latest standards using async/await which is much more cleaner and is shorter.



app.post("/login", async (req, res) => 
const userEmail = req.body.emailLogin,
userPassword = req.body.passwordLogin;
const user = await loginUser(userEmail, userPassword).catch(error =>
return res.status(401).send("Unauthorized");
);
res.render("index.js", user);
);

const loginUser = async (email, password) =>
try
const user = await firebase
.auth()
.signInWithEmailAndPassword(email, password);
return user;
catch (error)
throw error;

;


There's a concept of promises which I am not gonna go into because async/await is a syntactic sugar of it. You can read about all of it on async/await promises callbacks






share|improve this answer






























    1














    You are confused between callback and promise learn how to work with async operation



    Your code would look like this



    function loginUser(email, password)
    console.log(email, password);
    // return promise
    return firebase.auth().signInWithEmailAndPassword(email, password)
    .then(function(firebaseUser)
    // Success
    console.log('Ok, lovelly I'm logged');
    return firebaseUser
    )



    And controller would be



     const userService = require('./auth');

    app.post('/login', function (req, res) {

    var userEmail = req.body.emailLogin;
    var userPassword = req.body.passwordLogin;
    console.log(userEmail, userPassword); //This log the email and the password

    userService.loginUser(emailRegister, passwordRegister)
    .then(function ()
    res.render('user');
    )
    .catch(function (error)
    // Error Handling
    var errorCode = error.code;
    var errorMessage = error.message;
    console.log(errorCode); //auth/user-not-found
    console.log(errorMessage); //There is no user record corresponding to this identifier. The user may have been deleted.
    return res.status(401).send('Unauthorized');
    )





    share|improve this answer























    • hello, can you help me with this issue here? the code is similar. stackoverflow.com/a/55548093/10158519

      – alessandro buffoli
      Apr 6 at 14:59











    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55297702%2fget-the-succes-login-and-being-redirect-with-node-js%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    You have written your code in pre-ES6 standards using concept of callbacks



    const userService = require("./auth");

    app.post("/login", function(req, res)
    var userEmail = req.body.emailLogin;
    var userPassword = req.body.passwordLogin;
    console.log(userEmail, userPassword); //This log the email and the password

    userService.loginUser(
    userEmail,
    userPassword,

    function(error, authData)
    if (error)
    return res.status(401).send("Unauthorized");
    else
    res.render("user");


    );
    );


    But you forgot to include the callback argument in login user method and once login user method is successful call callback(null, result) and if its an error call callback(error).



    function loginUser(email, password, callback) 
    console.log(email, password);
    firebase
    .auth()
    .signInWithEmailAndPassword(email, password)
    .then(function(firebaseUser)
    // Success
    console.log("Ok, lovelly I'm logged");
    callback(null, firebaseUser);
    )
    .catch(function(error)
    // Error Handling
    var errorCode = error.code;
    var errorMessage = error.message;
    console.log(errorCode); //auth/user-not-found
    console.log(errorMessage); //There is no user record corresponding to this identifier. The user may have been deleted.

    callback(error);
    );



    I have rewritten the code using latest standards using async/await which is much more cleaner and is shorter.



    app.post("/login", async (req, res) => 
    const userEmail = req.body.emailLogin,
    userPassword = req.body.passwordLogin;
    const user = await loginUser(userEmail, userPassword).catch(error =>
    return res.status(401).send("Unauthorized");
    );
    res.render("index.js", user);
    );

    const loginUser = async (email, password) =>
    try
    const user = await firebase
    .auth()
    .signInWithEmailAndPassword(email, password);
    return user;
    catch (error)
    throw error;

    ;


    There's a concept of promises which I am not gonna go into because async/await is a syntactic sugar of it. You can read about all of it on async/await promises callbacks






    share|improve this answer



























      1














      You have written your code in pre-ES6 standards using concept of callbacks



      const userService = require("./auth");

      app.post("/login", function(req, res)
      var userEmail = req.body.emailLogin;
      var userPassword = req.body.passwordLogin;
      console.log(userEmail, userPassword); //This log the email and the password

      userService.loginUser(
      userEmail,
      userPassword,

      function(error, authData)
      if (error)
      return res.status(401).send("Unauthorized");
      else
      res.render("user");


      );
      );


      But you forgot to include the callback argument in login user method and once login user method is successful call callback(null, result) and if its an error call callback(error).



      function loginUser(email, password, callback) 
      console.log(email, password);
      firebase
      .auth()
      .signInWithEmailAndPassword(email, password)
      .then(function(firebaseUser)
      // Success
      console.log("Ok, lovelly I'm logged");
      callback(null, firebaseUser);
      )
      .catch(function(error)
      // Error Handling
      var errorCode = error.code;
      var errorMessage = error.message;
      console.log(errorCode); //auth/user-not-found
      console.log(errorMessage); //There is no user record corresponding to this identifier. The user may have been deleted.

      callback(error);
      );



      I have rewritten the code using latest standards using async/await which is much more cleaner and is shorter.



      app.post("/login", async (req, res) => 
      const userEmail = req.body.emailLogin,
      userPassword = req.body.passwordLogin;
      const user = await loginUser(userEmail, userPassword).catch(error =>
      return res.status(401).send("Unauthorized");
      );
      res.render("index.js", user);
      );

      const loginUser = async (email, password) =>
      try
      const user = await firebase
      .auth()
      .signInWithEmailAndPassword(email, password);
      return user;
      catch (error)
      throw error;

      ;


      There's a concept of promises which I am not gonna go into because async/await is a syntactic sugar of it. You can read about all of it on async/await promises callbacks






      share|improve this answer

























        1












        1








        1







        You have written your code in pre-ES6 standards using concept of callbacks



        const userService = require("./auth");

        app.post("/login", function(req, res)
        var userEmail = req.body.emailLogin;
        var userPassword = req.body.passwordLogin;
        console.log(userEmail, userPassword); //This log the email and the password

        userService.loginUser(
        userEmail,
        userPassword,

        function(error, authData)
        if (error)
        return res.status(401).send("Unauthorized");
        else
        res.render("user");


        );
        );


        But you forgot to include the callback argument in login user method and once login user method is successful call callback(null, result) and if its an error call callback(error).



        function loginUser(email, password, callback) 
        console.log(email, password);
        firebase
        .auth()
        .signInWithEmailAndPassword(email, password)
        .then(function(firebaseUser)
        // Success
        console.log("Ok, lovelly I'm logged");
        callback(null, firebaseUser);
        )
        .catch(function(error)
        // Error Handling
        var errorCode = error.code;
        var errorMessage = error.message;
        console.log(errorCode); //auth/user-not-found
        console.log(errorMessage); //There is no user record corresponding to this identifier. The user may have been deleted.

        callback(error);
        );



        I have rewritten the code using latest standards using async/await which is much more cleaner and is shorter.



        app.post("/login", async (req, res) => 
        const userEmail = req.body.emailLogin,
        userPassword = req.body.passwordLogin;
        const user = await loginUser(userEmail, userPassword).catch(error =>
        return res.status(401).send("Unauthorized");
        );
        res.render("index.js", user);
        );

        const loginUser = async (email, password) =>
        try
        const user = await firebase
        .auth()
        .signInWithEmailAndPassword(email, password);
        return user;
        catch (error)
        throw error;

        ;


        There's a concept of promises which I am not gonna go into because async/await is a syntactic sugar of it. You can read about all of it on async/await promises callbacks






        share|improve this answer













        You have written your code in pre-ES6 standards using concept of callbacks



        const userService = require("./auth");

        app.post("/login", function(req, res)
        var userEmail = req.body.emailLogin;
        var userPassword = req.body.passwordLogin;
        console.log(userEmail, userPassword); //This log the email and the password

        userService.loginUser(
        userEmail,
        userPassword,

        function(error, authData)
        if (error)
        return res.status(401).send("Unauthorized");
        else
        res.render("user");


        );
        );


        But you forgot to include the callback argument in login user method and once login user method is successful call callback(null, result) and if its an error call callback(error).



        function loginUser(email, password, callback) 
        console.log(email, password);
        firebase
        .auth()
        .signInWithEmailAndPassword(email, password)
        .then(function(firebaseUser)
        // Success
        console.log("Ok, lovelly I'm logged");
        callback(null, firebaseUser);
        )
        .catch(function(error)
        // Error Handling
        var errorCode = error.code;
        var errorMessage = error.message;
        console.log(errorCode); //auth/user-not-found
        console.log(errorMessage); //There is no user record corresponding to this identifier. The user may have been deleted.

        callback(error);
        );



        I have rewritten the code using latest standards using async/await which is much more cleaner and is shorter.



        app.post("/login", async (req, res) => 
        const userEmail = req.body.emailLogin,
        userPassword = req.body.passwordLogin;
        const user = await loginUser(userEmail, userPassword).catch(error =>
        return res.status(401).send("Unauthorized");
        );
        res.render("index.js", user);
        );

        const loginUser = async (email, password) =>
        try
        const user = await firebase
        .auth()
        .signInWithEmailAndPassword(email, password);
        return user;
        catch (error)
        throw error;

        ;


        There's a concept of promises which I am not gonna go into because async/await is a syntactic sugar of it. You can read about all of it on async/await promises callbacks







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 22 at 11:13









        Kiran Mathew MohanKiran Mathew Mohan

        640415




        640415























            1














            You are confused between callback and promise learn how to work with async operation



            Your code would look like this



            function loginUser(email, password)
            console.log(email, password);
            // return promise
            return firebase.auth().signInWithEmailAndPassword(email, password)
            .then(function(firebaseUser)
            // Success
            console.log('Ok, lovelly I'm logged');
            return firebaseUser
            )



            And controller would be



             const userService = require('./auth');

            app.post('/login', function (req, res) {

            var userEmail = req.body.emailLogin;
            var userPassword = req.body.passwordLogin;
            console.log(userEmail, userPassword); //This log the email and the password

            userService.loginUser(emailRegister, passwordRegister)
            .then(function ()
            res.render('user');
            )
            .catch(function (error)
            // Error Handling
            var errorCode = error.code;
            var errorMessage = error.message;
            console.log(errorCode); //auth/user-not-found
            console.log(errorMessage); //There is no user record corresponding to this identifier. The user may have been deleted.
            return res.status(401).send('Unauthorized');
            )





            share|improve this answer























            • hello, can you help me with this issue here? the code is similar. stackoverflow.com/a/55548093/10158519

              – alessandro buffoli
              Apr 6 at 14:59















            1














            You are confused between callback and promise learn how to work with async operation



            Your code would look like this



            function loginUser(email, password)
            console.log(email, password);
            // return promise
            return firebase.auth().signInWithEmailAndPassword(email, password)
            .then(function(firebaseUser)
            // Success
            console.log('Ok, lovelly I'm logged');
            return firebaseUser
            )



            And controller would be



             const userService = require('./auth');

            app.post('/login', function (req, res) {

            var userEmail = req.body.emailLogin;
            var userPassword = req.body.passwordLogin;
            console.log(userEmail, userPassword); //This log the email and the password

            userService.loginUser(emailRegister, passwordRegister)
            .then(function ()
            res.render('user');
            )
            .catch(function (error)
            // Error Handling
            var errorCode = error.code;
            var errorMessage = error.message;
            console.log(errorCode); //auth/user-not-found
            console.log(errorMessage); //There is no user record corresponding to this identifier. The user may have been deleted.
            return res.status(401).send('Unauthorized');
            )





            share|improve this answer























            • hello, can you help me with this issue here? the code is similar. stackoverflow.com/a/55548093/10158519

              – alessandro buffoli
              Apr 6 at 14:59













            1












            1








            1







            You are confused between callback and promise learn how to work with async operation



            Your code would look like this



            function loginUser(email, password)
            console.log(email, password);
            // return promise
            return firebase.auth().signInWithEmailAndPassword(email, password)
            .then(function(firebaseUser)
            // Success
            console.log('Ok, lovelly I'm logged');
            return firebaseUser
            )



            And controller would be



             const userService = require('./auth');

            app.post('/login', function (req, res) {

            var userEmail = req.body.emailLogin;
            var userPassword = req.body.passwordLogin;
            console.log(userEmail, userPassword); //This log the email and the password

            userService.loginUser(emailRegister, passwordRegister)
            .then(function ()
            res.render('user');
            )
            .catch(function (error)
            // Error Handling
            var errorCode = error.code;
            var errorMessage = error.message;
            console.log(errorCode); //auth/user-not-found
            console.log(errorMessage); //There is no user record corresponding to this identifier. The user may have been deleted.
            return res.status(401).send('Unauthorized');
            )





            share|improve this answer













            You are confused between callback and promise learn how to work with async operation



            Your code would look like this



            function loginUser(email, password)
            console.log(email, password);
            // return promise
            return firebase.auth().signInWithEmailAndPassword(email, password)
            .then(function(firebaseUser)
            // Success
            console.log('Ok, lovelly I'm logged');
            return firebaseUser
            )



            And controller would be



             const userService = require('./auth');

            app.post('/login', function (req, res) {

            var userEmail = req.body.emailLogin;
            var userPassword = req.body.passwordLogin;
            console.log(userEmail, userPassword); //This log the email and the password

            userService.loginUser(emailRegister, passwordRegister)
            .then(function ()
            res.render('user');
            )
            .catch(function (error)
            // Error Handling
            var errorCode = error.code;
            var errorMessage = error.message;
            console.log(errorCode); //auth/user-not-found
            console.log(errorMessage); //There is no user record corresponding to this identifier. The user may have been deleted.
            return res.status(401).send('Unauthorized');
            )






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Mar 22 at 10:46









            Sunil PatelSunil Patel

            12011




            12011












            • hello, can you help me with this issue here? the code is similar. stackoverflow.com/a/55548093/10158519

              – alessandro buffoli
              Apr 6 at 14:59

















            • hello, can you help me with this issue here? the code is similar. stackoverflow.com/a/55548093/10158519

              – alessandro buffoli
              Apr 6 at 14:59
















            hello, can you help me with this issue here? the code is similar. stackoverflow.com/a/55548093/10158519

            – alessandro buffoli
            Apr 6 at 14:59





            hello, can you help me with this issue here? the code is similar. stackoverflow.com/a/55548093/10158519

            – alessandro buffoli
            Apr 6 at 14:59

















            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55297702%2fget-the-succes-login-and-being-redirect-with-node-js%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

            Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript