Written for the Medium article: Passport.js HttpOnly Cookie JWT Authentication
Clone the repository and install dependencies:
$ git clone https://github.com/alphonso06/Node-Cookie-JWT.git
$ cd node-cookie-jwt
$ npm install
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
Simply run the command:
$ npm run dev
Everything should work if the env vars were setup correctly.
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.
ISC