Add JWT Auth To React Site

Job ID: 40238254

Budget: £20 – £250 GBP

My tech-news site is a React + Vite single-page app that currently stops at a public landing page. I now need a straightforward authentication layer so visitors can register, log in, and see protected content.

What I need you to do
– Build the full login / register flow using JSON Web Tokens (JWT), the option I’ve selected.
– Store the token securely (localStorage or cookies), refresh it when required, and clear it on logout.
– Protect routes with a wrapper/guard so unauthenticated users are redirected to the landing page and authenticated users reach the dashboard.
– Implement a simple role check for “Admin” so I can hide or show admin-only pages.
– Keep the code consistent with the current React Router setup and Vite build.
– Deliver clear, commented code so I can extend it later.

Time frame
This is a small, contained task; I expect it to be wrapped up within a few hours once you have the repo.

Acceptance
I’ll pull your branch, run `npm run dev`, register a user, log in, visit a protected route, refresh the page to confirm the session persists, and log out without token residue.

If you prefer to stub a lightweight Node/Express auth endpoint yourself to speed things up, note that in the proposal; otherwise I’ll point you to the existing API routes.

Experience wiring JWT auth into React apps is a must. If that sounds routine for you, let’s get this done today.