Skip to main content

Login Feature Reference

Frontend composition

  • frontend/src/pages/Login/index.js:33 renders the page and binds the form to Redux by dispatching userLoginAsync.
  • frontend/src/components/LoginForm/index.js validates inputs with Formik/Yup and surfaces field errors back to the parent via onError.
  • Google OAuth is wired through window.open(${API_URL}/auth/google) at frontend/src/pages/Login/index.js:60.

Request pipeline

  • userLoginAsync in frontend/src/context/authContext/actions/authActions.js:156 calls userLoginService, stores the access token in Redux and local storage, and syncs user settings once authentication succeeds.
  • The login page listens to loginError and userLoginLoading flags so it can keep the spinner active and display snackbar feedback.

Backend endpoints

  • backend/r/auth_all.js:16 exposes GET /auth/google and the callback handler for OAuth with passport.
  • backend/r/auth_all.js:236 registers POST /auth/login, delegating to authController.signin for credential checks, session cookies and token minting.
  • Rate limiting, session cookies and helmet policies are applied globally in backend/server.js:41 onward before the auth router mounts.

Error handling

  • The controller returns structured messages ({ msg: ... }), which are passed untouched to the snackbar through userLoginFailure.
  • Non-401 transport issues bubble up as a generic �Sign in failed� message but keep the form in place so the user can retry without losing input.
  • Google OAuth failures redirect to /auth/login/failed, which the UI treats as a normal login error.