Okta-react package module doesn't work as static files from express server

I have deployed my app using express.js on the backend and react.js on the front-end. After I ran ‘npm run build’ and reference the build directory from Express, I was able to get my app to render the react components through the server-side.

The issue here is when making calls to the ‘@okta/okta-react’ package such as okta.signIn(), I first got a 401 api/ Authentication error thinking it was a CORs or related problem. After further debugging, starting up client-side (npm start (dev), NOT npx serve(prod)), the okta.signIn() works.

Does the ‘@okta/okta-react’ package not work in Production? Is it because I’m serving this as a static file through express? What is the solution here? Do i have to implement the okta server side instead, if so, whats the purpose of the react package?

Reason for using express:

  • True HTTPS server-side
  • Mailer Integration
  • Other Third-party integration