2

I am building a MERN stack application and trying to use the connect-wwwhisper package to protect access to an application (testing beta version) that I am hosting. I am using passport authentication on the Node js backend for user authentication but I want to layer wwwhisper package on entire app so that only people with approved email may access the entire app without disturbing the passport authentication that I set up. I have set up wwwhisper per the documentation: https://devcenter.heroku.com/articles/wwwhisper but there is a conflict with the redux thunk middleware that is causing a type error within the redux js file below:

    function compose() {
    for (var _len = arguments.length, funcs = new Array(_len), _key = 
    0; 
    _key < _len; _key++) {
    funcs[_key] = arguments[_key];
    }

    if (funcs.length === 0) {
    return function (arg) {
      return arg;
    };
    }

    if (funcs.length === 1) {
    return funcs[0];
    }

    return funcs.reduce(function (a, b) {
    return function () {
      return a(b.apply(void 0, arguments));

The error message is: Uncaught TypeError: Cannot read property 'apply' of undefined

In my server js file I am using the following to direct requests to the index.html file of the react side of the application. All other requests to the backend api are using the

    app.use("routename");

    if (process.env.NODE_ENV === "production") {
      app.use(express.static("client/build"));
      app.get("*", (req, res) => {
      res.sendFile(path.resolve(__dirname, "client", "build", 
      "index.html"));
     });
     }

The wwwhisper middleware does protect the application and sends out the tokenized link to access the application but when I try to access the application I get the above error message along with a message saying the token is unauthorized. The author of the wwwhisper middleware is not familiar with how the wwwhisper middleware may be interacting with the Redux thunk middleware. How can I get this to work? I've been programming for about a year so any help is appreciated.

0 Answers0