Okta, Express, and React - login/callback is not working with static react page running in express

I have a node.js (express) which serve the react app as static. The problem I am having is when the login/callback which comes back to the express server and not to my static single page react route.

The server had the director build which I build (npm run build) for my react app and copied the build directory under the express server.

Here is the snippet of the server.js which used express.static.


app.get("/", (req, res) => {
res.sendFile(path.join(__dirname, ‘build’, ‘index.html’));

app.use(express.static(path.join(__dirname, ‘build’)));


After it launches the app (eg. http://someserver.com) it comes back to the http://someserver.com/login/callback.

I was expecting it will come to the react route /login/callback.

Any ideas?