Parse.com unable to get username from Parse.User.current?

javascript, parse-platform, promise

Solution

user.fetch().then(function(fetchedUser){
    var name = fetchedUser.getUsername();
}, function(error){
    //Handle the error
});

Here the issue is `Parse.User.current()` method will return a user object if the user logged in or signed up successfully, but this object wont be having all the details of the user object. In order to get all the object properties you have to call `fetch` method on a user `Object`.

Problem

Using javascript, after the user logs in successfully, I tried to extract the username as below: ``` var user = Parse.User.current(); name = user.getUsername; ``` The value of name is: `function (){return this.get("username")}` If I use `name = user.getUsername();` The value is undefined!!

Original source