Giter Club home page Giter Club logo

Comments (10)

mesaugat avatar mesaugat commented on May 19, 2024 1

I've already made some progress on that without using Passport. I just want to make a simple JWT authentication module. Anyone who wants to use Passport can then make changes as they want to.

from express-api-es6-starter.

duard avatar duard commented on May 19, 2024

What about authentication using Passport and JWT ?

from express-api-es6-starter.

duard avatar duard commented on May 19, 2024

Could you merge the implementation of JWT to us ? I would like to see it.

from express-api-es6-starter.

mesaugat avatar mesaugat commented on May 19, 2024

But it should take some time. I don't have the time right now. I did it a few months back and need to look into it before merging.

from express-api-es6-starter.

duard avatar duard commented on May 19, 2024

Ok, if you want, you could just share the code on gists.github.com

from express-api-es6-starter.

mesaugat avatar mesaugat commented on May 19, 2024

I've pushed some changes in the auth branch. Not sure if it works now but you can have a look. I'll try to do finish this in a few weeks.

from express-api-es6-starter.

duard avatar duard commented on May 19, 2024

I'm trying to use yout util crypt functions ... how can I wait this Promise crypt.hash in my model ?

my User model :

  initialize() {
    this.on('creating', this.hashPassword);
  }
  hashPassword() {
    let pass = this.get('password');
    console.log(`=> my pass ${JSON.stringify(pass)}`);
    crypt.hash(pass).then(hash => {
      this.set('password', hash);
    })
  } 

from express-api-es6-starter.

duard avatar duard commented on May 19, 2024

I change Utils crypt.has to

 hash(string) {
    let saltRounds = parseInt(process.env.AUTH_SALT_ROUNDS);
    const newPass = bcrypt.hashSync(string, saltRounds);
    console.log(`SALTS => ${saltRounds} ${string} ${newPass}`);
    return newPass
  },

and in my model

  hashPassword() {
    let pass = this.get('password');
    console.log(`Password Criptografado ${JSON.stringify(pass)}`);
    let newPass = crypt.hash(pass);
    console.log(`===> ${newPass}`);
    this.set('password', newPass);
  }

now it works;

from express-api-es6-starter.

mesaugat avatar mesaugat commented on May 19, 2024

It returns a Promise, you'll have to await or return bcrypt.hashSync as you have done.

from express-api-es6-starter.

mesaugat avatar mesaugat commented on May 19, 2024

Out of scope right now.

from express-api-es6-starter.

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.