Skip to content

a Simple implementation of JWT Token auth with NodeJS and Express

Notifications You must be signed in to change notification settings

negativo/JWT-Auth-NodeJS-Starter-Kit

Repository files navigation

Simple Node JWT-Token Authentication starter kit.

alt tag

This repo uses JSON Web Tokens and the jsonwebtoken package to implement token based authentication on a simple Node.js API with a MongoDB Database.

This is a starting point to have an API up and running in notime.

The Api Features:

- JWT Auth Token
- User Management

##Installation

###With Docker

  • edit .env.example and save it as .env
  • docker-compose up

###Without Docker

This project needs NodeJS > v5.0.0, MongoDB and forever to manage the process.

  • clone the project git clone git@github.com:negativo/JWT-Auth-NodeJS-Starter-Kit
  • run npm install
  • run mongod
  • edit .env.example and save it as .env
  • npm start
  • npm test

##API

###Setup test user

To setup an admin user edit your .env file and request the url http://localhost:8282/setup

curl http://localhost:8282/setup

###Versioning

###Authenticate

To authenticate a user do a POST request to http://localhost:8282/auth with the name and the password in the body

{
	name:"jwtauth",
	password:"jwtauth"

}

curl -H "Content-Type: application/json" -X GET http://localhost:8080/setup curl -H "Content-Type: application/json" -X POST -d '{ "name":"user","password":"password"}' http://localhost:8080/api/auth

About

a Simple implementation of JWT Token auth with NodeJS and Express

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published