Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/negativo/JWT-Auth-NodeJS-Starter-Kit
a Simple implementation of JWT Token auth with NodeJS and Express
https://github.com/negativo/JWT-Auth-NodeJS-Starter-Kit
auth javascript jwt mongodb nodejs
Last synced: 3 months ago
JSON representation
a Simple implementation of JWT Token auth with NodeJS and Express
- Host: GitHub
- URL: https://github.com/negativo/JWT-Auth-NodeJS-Starter-Kit
- Owner: negativo
- Created: 2016-07-25T08:51:55.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-01-23T17:38:36.000Z (almost 2 years ago)
- Last Synced: 2024-08-02T06:24:16.860Z (6 months ago)
- Topics: auth, javascript, jwt, mongodb, nodejs
- Language: JavaScript
- Size: 364 KB
- Stars: 8
- Watchers: 3
- Forks: 8
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Simple Node JWT-Token Authentication starter kit.
![alt tag](http://i.imgur.com/vlLzUe4.gif)
This repo uses JSON Web Tokens and the [jsonwebtoken](https://github.com/auth0/node-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 [email protected]: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`