Giter Club home page Giter Club logo

express-jwt-authentication-starter's Introduction

Hi there, I'm Zach.

Iโ€˜m a software engineer living in Cincinnati, OH. I'm currently working full-time on Maybe, a COSS personal finance app. I also maintain a few golf websites and run Full Stack Foundations. You can learn more about myself and the projects I'm involved in here.

Connect with me:

Zach Gollwitzer | Twitter Zach Gollwitzer Website Zach Gollwitzer | YouTube Zach Gollwitzer | LinkedIn



express-jwt-authentication-starter's People

Contributors

dependabot[bot] avatar zachgoll avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

express-jwt-authentication-starter's Issues

Unauthorized

Hi, I am following your tutorial, I got "Unauthorized" response when I attached bearer token on Authorization header.
I tried by clone the "final" branch but got the same result on postman an Angular app. (after npm install, genKeypair)
Console.log(jwt_payload) didn't show anything.
Can anyone help me on this?

jwt iat & exp

Hi I just wanted to highlight something as well as suggest the fix should it be wanted.

In the issueJWT function in your utils.js file, the payload sets the iat key to Date.now(). This isn't correct as it sets iat to milliseconds representation, rather than seconds. It also creates an issue in that the jwt sign function uses expiresIn '1d'. This in turn is not then set correctly, based upon the iat date being issued in the distant future. It does not seem to generate a jwt that has valid iat or exp claims when you check it on jwt.io, and it doesn't expire the jwt's authorizaton as expected the following day.

The solution is to amend the payload to set the iat to seconds as such:

const payload = {
    sub: _id,
    iat: Math.floor(Date.now() / 1000)
  };

This then sets the iat, and more importantly the exp claims correctly so that the jwt correctly expires as checked by passport.

Hope this helps

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.