Skip to content

When logging in a user via website, should I do it server side or client side? #659

Closed
@farhan-syed

Description

@farhan-syed

Hello currently I have this as a POST method on my backend:

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

  login();

function login() {
    Parse.User.logIn("username", "test", {
        success: function(user) {
            // Do stuff after successful login, like a redirect.
            console.log('User logged in successful with username: ' + user.get("username") + ' and email: ' + user.get("email"));
            console.log(user.sessionToken)

        },
        error: function(user, error) {
            console.log("The login failed with error: " + error.code + " " + error.message);
        }
    });
}
  
  res.status(200).send("logging in");

});

Is this the right approach? Also if it is, how would I go about setting a current user? Do I just do that client side?

Would appreciate the direction, thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions