Search code examples
node.jsauthenticationregistrationchange-passwordforgot-password

Node.JS webapp: Authentication, Create Account, Forgot Password and Change Password


I would like to develop a new web-app in node.js (using express). I am relatively new to node.js world, so I assume there are frameworks that I am not familiar with.

Is there any framework (like Spring for Java) that manages authentication (and save the trouble from the developer)? Or each developer has to write this code over and over again?

Login/Logout is not all. There are other flows:

  • registration (create account),
  • forgot-password (and then set new password),
  • locking/unlocking an account,
  • change password

and I think I have covered all flows.

I know that each application has its own UI, forms, maybe with its logo, but the flow itself is similar for most applications. In addition, I know that it is not that hard to implement, but it could be great to have some kind of tool / framework / infrastructure which implements the flows.

Is there such a tool/framework which helps applications' developers and implements these flows?

I've searched this issue but could not find anything.

Thanks!


Solution

  • Long ago I have developed authentication-flows for Java over Spring, and recently I wrote authentication-flows-js.

    It is a module that answers most flows - authentication, registration, forgot-password, change password etc., and it is secured enough so applications can use it without the fear that it will be easily hacked.

    It is for node.js applications (written in TypeScript) that use express. It is an open source (in GitHub). A release version is on npm, so you can use it as a dependency in your package.json.

    In its README (and of course in the npm page) there are detailed explanations for everything and if something is missing - please let me know. An article will be published soon (I will add a link as a comment).

    You can find here an example for a hosting application.

    new - A demo app is available on GAE!

    NOTE: I have heard comments like "It's not so difficult to implement". True. But you have to make sure you take care of all cases. For example, what happens if a user tries to create account that is already exists? what happens if a user tries to create account that is already exists but inactive? what about the policy of the password? (too long/too short/how many capital etc.) what about sending the email with the activation link to the user? how you create this link? should you encrypt it? what about the controller that will receive the click on the link and activate the account? and more...