< Previous Article Next Article >

pjs.getUser()

pjs.getUser() returns the currently authenticated user.

If deployed directly on NodeRun.com, the returned value is a NodeRun user id. When your application is deployed on another system, such as IBM i, the API will return the current user for that system.

If the user has not authenticated, the API returns null.

// Require user to be logged in
let user = pjs.getUser();
if (!user) {
  display.login.execute();
  return;
}

Questions?

Have questions about this topic? Ask for help on our NodeRun Discussion Forum.

< Previous Article Next Article >