Encrypting passwords using BCrypt to save in our mongoDB. Tutorial Source can be found @ https://github.com/BrentAureli/Youtube-Tutorials Credit: Various …

source

17 Comments

  1. excellent video my friend, you earned a new suscriber……it's nice how you explain all the things you use in a simple way

  2. Hi Brent, Very good tutorials. Being a beginner these have helped me a lot in learning. I am bit confused with understanding of REST APIs. Are you using REST apis when you write app.get(), app.post(). But, i dont see all CRUD operations here. Please guide. I may be totally wrong. please correct me.

  3. hey man. love your tuts. just wanna share . i used bcrypt-nodejs instead of bcrypt only. kept getting errors when installing bcrypt only. works like brcypt also.

  4. +Brent Aureli I noticed on the bcrypt package page that the Asynchronous method is recommended for generating and comparing the hash.  What would be a good situation and Async method would be useful for this Authentication process?  Aren't the users going to have to wait for this hashing process to complete anyway? It seems to me as if sync is the most logical way for this.

  5. +Brent Aureli   Hi Brent,  I have another question this time..
    When I was learning postgreSQL in school,  my teacher told me to beware of handling connections, and make sure that I have to close the connection to database once I have got the data and saved the data. 
    Should I do the same thing for mongoose?  I have tried to just close the application, but the connections are just remaining as opened and the number of connections is growing up next time go to my local host again.. How can I deal with this?

    I have implemented a method in User.js and called this method in passport.js. I expected by doing so, for example signing up, a user would be created and saved to my database and connection will be closed afterward.. The result was a user was saved into my database but the web was unfortunately just staying on the signup page without redirecting me to the profile page… Would you mind giving me some suggestions please?

    in user.js

    userSchema.methods.disconnect = function(){
    mongoose.disconnect();
    }

    in passport.js
    process.nextTick(function(){

    newUser.save(function(err){

    if(err)
    throw err;
    newUser.disconnect();
    return done(null, newUser);
    }
    }

    Thanks a lot~

  6. +Brent Aureli Thanks for your brilliant tutorials 🙂
    I have come up with a question after this video.  It looks like that password is being encrypted or hashed (actually which one is the right word?) on the server, upon Signup and also Login

    In order to enchance sercurity, Is it possible to implement Bcrypt or other techniques on the web application, such that the password will be encrypted before sending to the server?

  7. Brent could you help with this please: PS C:users (comptername)jstudionodeprojectfirsttemplate> node server.js
    { [Error: Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' }
    js-bson: Failed to load c++ bson extension, using pure JS version
    { [Error: Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' }
    js-bson: Failed to load c++ bson extension, using pure JS version
    { [Error: Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' }
    js-bson: Failed to load c++ bson extension, using pure JS version
    { [Error: Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' }
    js-bson: Failed to load c++ bson extension, using pure JS version
    C:usersthe familyjstudionodeprojectfirsttemplateconfigpassport.js:45
      passport.use('local-login', new LocalStrategy({
                                      ^
    ReferenceError: LocalStrategy is not defined
        at module.exports (C:usersthe familyjstudionodeprojectfirsttemplateconfigpassport.js:45:35)
        at Object.<anonymous> (C:usersthe familyjstudionodeprojectfirsttemplateserver.js:15:29)
        at Module._compile (module.js:460:26)
        at Object.Module._extensions..js (module.js:478:10)
        at Module.load (module.js:355:32)
        at Function.Module._load (module.js:310:12)
        at Function.Module.runMain (module.js:501:10)
        at startup (node.js:129:16)
        at node.js:814:3
    PS C:usersthe computername path is therejstudionodeprojectfirsttemplate> 

    this is happen when i run the node server.js and for the database.js i you dont have a database online and want to use the robomongo data base , how to create the path in the database.js file.

  8. A had the same issue to install bcrypt.

    According to the README.md from bcrypt-nodejs, the issue for install bcrypt is the main reason for the creation of it:

    "Native JS implementation of BCrypt for Node.
    Has the same functionality as [node.bcrypt.js] expect for a few tiny differences.
    Mainly, it doesn't let you set the seed length for creating the random byte array.

    I created this version due to a small [problem](https://github.com/ncb000gt/node.bcrypt.js/issues/102) I faced with [node.bcrypt.js].
    Basically, to deploy one of my apps which uses [node.bcrypt.js] on a winx64 platform, I have to force the user to download about 1.6gb of sdks, buildtools and other requirements of which some fail to install ! Microsoft :("

  9. I was getting the same error, i installed bycrypt-nodejs and then i copied the bCrypt.js file from G:nodejstutorial5node_modulesbcrypt-nodejsbCrypt.js   to  G:nodejstutorial5node_modules and then everything was working fine without any change in code. I didn't even use python!!!  Hope it helps.

Leave A Reply

Please enter your comment!
Please enter your name here