https://github.com/dynamicsingh/node-jwt-auth-app
Authenticating via JWT using express route middleware
https://github.com/dynamicsingh/node-jwt-auth-app
Last synced: 4 months ago
JSON representation
Authenticating via JWT using express route middleware
- Host: GitHub
- URL: https://github.com/dynamicsingh/node-jwt-auth-app
- Owner: dynamicsingh
- Created: 2017-02-05T06:41:58.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-02-05T06:47:00.000Z (over 8 years ago)
- Last Synced: 2025-01-16T10:34:24.714Z (6 months ago)
- Language: JavaScript
- Homepage:
- Size: 1.95 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# node-jwt-authentication-app
Demonstrating authentication by verifying a token using Express route middleware.
## Requirements
- node, npm, express and mongoose
## Usage
1. Clone the repo
2. Install dependencies: `npm install`
3. Change SECRET in `config.js`
4. Add your own MongoDB database to `config.js`
5. Start the server: `node server.js`
6. Create sample user by visiting: `http://localhost:3000/setup`Once everything is set up, we can begin to use our app by creating and verifying tokens.
### Getting a Token
Send a `POST` request to `http://localhost:3000/api/authenticate`.
### Verifying a Token and Listing Users
You can also send the token as a URL parameter: `http://localhost:3000/api/users?token=YOUR_TOKEN_HERE`