← modules / auth

Email + password (JWT)

auth-jwt

Register, login, refresh and logout with argon2 password hashing, JWT access tokens and rotating refresh tokens

add it to a devstack project

npx create-devstack-app add auth-jwt

requires

requires one of

  • http:express
  • http:fastify
  • http:nest

Environment

  • JWT_SECRET · required · secret

    Signs access tokens (HS256): 32 random bytes or more, e.g. openssl rand -base64 32. Generated for local use

  • JWT_ACCESS_TTL_MINUTES

    Access token lifetime in minutes

  • REFRESH_TOKEN_TTL_DAYS

    Refresh token lifetime in days; each use issues a new one

  • ALLOWED_ORIGINS

    Comma-separated origins allowed to call the API, e.g. https://app.example.com