Skip to content

An easy-to-understand Passport.js JWT authentication server app

Notifications You must be signed in to change notification settings

alphonso06/Node-Cookie-JWT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Node Cookie JWT Tutorial

Written for the Medium article: Passport.js HttpOnly Cookie JWT Authentication

Install

Clone the repository and install dependencies:

$ git clone https://github.com/alphonso06/Node-Cookie-JWT.git
$ cd node-cookie-jwt
$ npm install

Environment Variables

At the root of the project, create dev.env to store your env vars. Inside you'll need to store your USER and PASSWORD values. You'll also need to add the JWT_SECRET and JWT_EXPIRATION values.

USER=genericGuy
PASSWORD=Ultr@S3cUr3!
JWT_SECRET=wow123
JWT_EXPIRATION_TIME=600000

Running the app

Simply run the command:

$ npm run dev

Everything should work if the env vars were setup correctly.

API Routes

It's recommended that you use something like Postman to test the routes, otherwise you can use whatever you're comfortable with as long as it works fine for you.

License

ISC

About

An easy-to-understand Passport.js JWT authentication server app

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published