Skip to content

Parse.User.current not working? Do i use something else? #2020

Description

@farhan-syed

here is what im doing, the app.post works for login, but when it goes to app.get, Parse.User.current is null

app.post('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/login', function(req, res) {
  Parse.User.logIn(req.body.username, req.body.password, {
  success: function(user) {
    // Do stuff after successful login.
    console.log('user: ' + user);
    res.redirect('/home');
  },
  error: function(user, error) {
    // The login failed. Check error to see why.
    console.log('error login');
    res.redirect('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/login');
  }
});

});


app.get('/home',function(req, res){

if (Parse.User.current()) {
      // No need to fetch the current user for querying Note objects.
  var currentUser = Parse.User.current();
  var sessionToken = currentUser.get('sessionToken');

  console.log(sessionToken);
    }
});

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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