GithubHelp home page GithubHelp logo

node-mvc-express-jwt's Introduction

Review Assignment Due Date

"Express JS Tutorial - User Authorization"

Dave Gray ownership

This repo is a copy of a repo from Dave Gray

Your can find the source here

โœ… Check out the Dave's Gray YouTube Channel with all of his tutorials.

Description

This repository shares the code applied during a Youtube tutorial made by Dave Gray. To complete the challenge, you can complete the tutorial here: JWT Authentification in an Express app.

The mission:

We gevi you a pre-made code. It's a simple application made with Express and an architecture MVC (Model-View-Controller). This app stores users in a json file. The users are able to connect to the app via a password. But we would like to add a security layer.

So the goal is to implement a JWT authorization.

Your implementation should use the jsonwebtoken NPM package, specifically the sign() and verify() method.

  • Create a strong secret key, and put it in an gitignored .env file
  • Create a POST route in which you can connect to the with an user. Inside that route create a token using the JWT.sign method, that contains the username, a passsword, and sign it using your secret key.
  • Create a middleware to validate the token, using the JWT.verify method.
  • Create a token-protected route by using your middleware. To access this route the user should add their token in their Authorization request header.

use the app:

Install packages: npm install

Run the server: npm run dev

The routes :

  • The homepage: localhost:3500/
  • Register a user: localhost:3500/register
  • Login: localhost:3500/auth

Academic Honesty

Avoid plagiargism and adhere to the spirit of this Academic Honesty Policy.

node-mvc-express-jwt's People

Contributors

crolette avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.