Get logged user information in custom node

How can I get the information of the logged user at myNode.js

It will depend on how you have implemented the user list.

Hi @chiche

it depends what exactly you are trying to do in myNode.js.

A node deployed in the runtime has no knowledge of the editor or any concept of users.

The only place you may have code in myNode.js that cares about editor users is if you have created a custom admin HTTP endpoint that gets called by the editor as part of your node's edit dialog.

In that context, as long as you include the RED.auth.needsPermission middleware, the req.user property should tell you who the user is calling the end point.

RED.httpAdmin.get("my-custom-node/do-something", RED.auth.needsPermission(''), function(req, res) {
   // req.user should identify the user.

Oh, I see. I was able to get the information, thanks a lot!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.