Giter Site home page Giter Site logo

Comments (5)

sinner avatar sinner commented on May 10, 2024 2

This project doesn't work. Good idea but, it doesn't work

from express-typescript-boilerplate.

dweber019 avatar dweber019 commented on May 10, 2024

Hi @sinner

Please have a look at authorizationChecker.ts in auth for validating the token.

from express-typescript-boilerplate.

sinner avatar sinner commented on May 10, 2024

Hi @dweber019!

Thank you very much for your response.

It's difficult to know that, moreover, I think there will be a list of URLs enable to manage a JWT connection (sign-up, sign-in, logout, refresh-token...).

Do I need to put this logic inside the authorizationChecker.ts file or it's already there?

from express-typescript-boilerplate.

dweber019 avatar dweber019 commented on May 10, 2024

Hi @sinner

We mostly use Auth0 or an other authorisation party which will provide the JWT management urls.
The authorizationChecker.ts is only for checking that a token is provided and valid. So it's like a hook and is no opinionated.

If you use the @Authorized decorator, then the authorizationChecker.ts is used to check if the user is authorised => has a valid token.
See here for usage of @Authorized: https://github.com/w3tecch/express-typescript-boilerplate/blob/develop/src/api/controllers/PetController.ts#L7

If you like to have management urls like provisioning a token for user you have to implement that by your self. I would suggest you use passportjs. Here a good example how to implement jwt with a node app: https://scotch.io/tutorials/authenticate-a-node-js-api-with-json-web-tokens
According to the tutorial you would also create a route like authenticate and check the token in the authorizationChecker.ts with jwt.verify(token, ....

from express-typescript-boilerplate.

dweber019 avatar dweber019 commented on May 10, 2024

@sinner Sorry to hear that.
Our goal is to be not opinionated on authentication. Additionally we use this boilerplate in a more mature architecture, where the authentication is done by a other system. This is because of SSO, audit trails and a lot of other security reasons.

from express-typescript-boilerplate.

Related Issues (20)

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.