Check if user is logged in inside the server plugin.
-
Hello,
I am a newbie to plugin
and am trying to make a plugin where I will need to check if the user is logged in first prior to any action.I was able to make it work by using a POST type request in client and req.user.uid in server-side function.
Can this work with GET type as well? Somehow req.user is not retrieved in server side library.js function.
Basically I am looking for a way to ensure that any request (regardless of GET/POST) is processed only for users who are logged in. -
Can this work with GET type as well? Somehow req.user is not retrieved in server side library.js function.
This should be possible, ex.
nodebb-plugin-twilio/library.js at master · psychobunny/nodebb-plugin-twilio
Mobile verification for NodeBB using Twilio. Contribute to psychobunny/nodebb-plugin-twilio development by creating an account on GitHub.
GitHub (github.com)
and
nodebb-plugin-twilio/library.js at master · psychobunny/nodebb-plugin-twilio
Mobile verification for NodeBB using Twilio. Contribute to psychobunny/nodebb-plugin-twilio development by creating an account on GitHub.
GitHub (github.com)
if (req.user && req.user.uid) { // logged in }
can you link the code perhaps, and git revision if possible
-
@psychobunny Thanks a lot for the info. I will take a look.