Auth token flow

Signup, login, and access a protected dashboard.

Auth

Create an account

Stores a bcrypt-hashed password and unique email.

Auth

Login + get JWT

Token is saved to localStorage for persistence.

Protected

Dashboard

Uses your token to call /api/profile. If no token, it redirects to login.

Token expiry

1 day

Password

bcrypt hash

Auth state

Context

Logo

API

Endpoints

  • POST /api/auth/signup
  • POST /api/auth/login
  • GET /api/profile

Session

Stay logged in

Token is loaded on refresh and profile is fetched automatically.