Skip to content

A jumping off point for any REST API requiring user authentication. This scaffolds out a basic user and authentication flows.

License

Notifications You must be signed in to change notification settings

stradox4u/node-typescript-auth-starter

Repository files navigation

Basic Authentication API

Here's a basic API for user authentication using Node JS, Express JS, Passport JS and Typescript, complete with tests.

It uses an email and password for signup and subsequent logins, with JWT authentication for subsequent requests. Blacklisted refresh tokens are stored in the user model, and access tokens only last for 10 mins, although the token validity could be configured.

Installation

  • git clone
  • npm install
  • create a config/config.json in the project root, and choose your database (SQL) dialect
  • run npx sequelize-cli db:migrate
  • create a Sendgrid account, and update the API key and your email template Ids
  • an example .env file is provided. Create your own, using it as a template, and fill out all the fields

Running

  • To run the development server: npm run dev
  • To run the production server: npm start

Testing

  • To test, run npm test

About

A jumping off point for any REST API requiring user authentication. This scaffolds out a basic user and authentication flows.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published