Module not found error while doing an okta sitepoint tutorial setup

Hi everyone,

I am doing this tutorial: https://www.sitepoint.com/build-react-app-user-authentication-15-minutes/

We have followed the tutorial and run into some issues.

this app.js does not have a class to export that holds the render.

The error we are getting is :

ERROR in ./src/app.js
Module not found: Error: Can’t resolve ‘./components/auth/LoginPage’ in ‘/Users/NEWCOMPUTER/Desktop/okta-react-widget-sample/src’
@ ./src/app.js 27:17-55
@ multi (webpack)-dev-server/client?http://localhost:3000 ./app.js
webpack: Failed to compile.

However, our app.js file is the same as the sample app.js file in the author’s given sample github for setting up okta.

From the error, it seems like you don’t have LoginPage.js inside the src/components/auth/ directory.
Can you confirm that you have followed the exact steps mentioned in the section “The LoginPage Component” in the tutorial?
It asks you to create the LoginPage.js file in src/components/auth/ directory.

Hi ,
we have a LoginPage.js there. However , I’m perplexed why the code is grey and not colored like the other .js files.

You can try running the completed version of this project from here - https://github.com/leebrandt/okta-react-widget-sample
Not sure what is wrong in your setup though.

Do you have your code in GitHub or somewhere I can take a look?

I found the issue. There was a space after the LoginPage.js. :roll_eyes:

I have a new issue now. The sessions were not in the tutorial and the Response to preflight request doesn’t pass shows after attempt at sign in , as well as ‘Unable to connect to the server. Please check your network connection.’
“There was an error sending the request - have you enabled CORS?”

There really needs to be a thorough tutorial on okta sign in set up…

1 Like