Uncaught ReferenceError: require is not defined

Hmmm I guessed you might be on the wrong road. So this error...

... is client side right?

Installing node-modules in node-red does not automatically present them to the client.

Unfortunately, I have never implemented custom user auth for node-red - hopefully someone else can chime in.