getCurrentUser javascript example

I am trying to use the getCurrentUser method with javascript and cannot get it working. I looked in the docks for an example at But it looks to me like this example is not in javascript but java instead even though it is in the javascript docs. I also saw this forum post: where it mentions method loggedInUser.

Can you please point me to somewhere in the doc that has a javascript example of getCurrentUser or similar method being used in a hosted script?


Hi GregMc,

How about this:

Backendless.UserService.login( userId, password );
var currentUserObjectId = Backendless.UserService. loggedInUser();
var currentUser = Backendless.Data.of( Backendless.User ).findById( currentUserObjectId );

Hope this helps.