You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A user must be able to create an account and log in securely. Sessions are managed by Redis.
Backend Tasks:
Create a /api/register endpoint that takes user details, hashes the password (use bcrypt), and saves to the users table.
Create a /api/login endpoint that validates credentials.
On successful login, generate a random session token, store {user_id, role} in Redis with the token as the key, and set a 24h expiry.
Create an authentication middleware that protects routes. It must check for a Authorization: Bearer header, validate the token against Redis, and pass user info into the request context.
Frontend Tasks:
Create a RegisterPage.jsx component with a form that calls the /api/register endpoint.
Create a LoginPage.jsx component with a form that calls the /api/login endpoint.
On successful login, store the session token in a secure HttpOnly cookie or localStorage.
Configure your Axios instance to automatically include the token in all future requests.
Implement a ProtectedRoute component that redirects to /login if no user is authenticated.
A user must be able to create an account and log in securely. Sessions are managed by Redis.
Backend Tasks:
Frontend Tasks: