Metamask authentication with passport, express, nodejs - node.js

I am looking for a secure Metamask Login library that seamlessly fits into the "hackathon starter project".
Since I haven't found anything useable and i'm personally not confident to just start writing my own passport strategy it would be nice if someone more experienced than me can direct my efforts.

There's no need to roll your own - there's already an existing Metamask strategy for Passport [1].
[1] https://github.com/jgostylo/passport-metamask

Related

Question regarding passport.js' level of security

Just have some general questions about the level of security one can expect when using passport for an App's Authentication;
I am currently in the process of designing my first App using a MongoDB, Express, React and Node.js stack. Without having much prior knowledge about cyber security I have done quite a bit of research about authentication and what type of attacks can occur on my site. I have opted to use a cookie-based authentication system with the passport.js npm package and I have designed my /login route to require that the user's password and username first pass a passport.authenticate('local', ....) middleware setup before a session and cookie are created.
In order to persist the current user in my react app, I have a function which requests the server to provide it with the currently active passport session if there is one - and this seems to work as it will not maintain a login state if the user deletes the session cookie from their browser.
I am a bit skeptical of passport and I'm curious to know how easily it could be breached by someone who has a higher understanding of how it works, so the things I am wondering are several:
Is this type of authentication setup secure?
Are there any additional requirements that one must implement in order for passport to be a
legitimate method of authentication for an App?
Is using passport to authenticate users considered to be bad practice? Would showcasing an app that
authenticates users by using an npm package look bad if I were to showcase this application to a
potential employer?
I can share code if necessary to better illustrate my code setup, although I would prefer not to if at all possible. Any advice would be much appreciated, thanks!
TLDR:
Is passport.js a secure method to authenticate users? Is using passport.js for this bad practice?
Passport.js provides authentication, not security. It is fairly easy to misconfigure by following online tutorials, so take care - the tool is only as good as the hand it is in. To add security to passport, you will need at the very least three additional elements:
Strong state model for the session (or token) that does not leak private fields and uses argon2 for password hashing.
No mistakes on the front-end with CSRF or XSS.
Rate and buffer limitters on Node itself or, even better, on your reverse proxy.

Graphql/Prisma, autorization with or without passport?

I'm creating an API with graphql and Prisma and have been following this tutorial for tips and trix: https://www.howtographql.com/graphql-js/6-authentication/. When they reached authorization they opted not to use middleware like passport.js but instead wrote their own logic as you can see in the link. I'm simply wondering why and if this solution is lacking in a security perspective?
passport is really handy if you want to setup facebook, twitter and google auth. For simple password login just write your own functionality, it is simpel todo and gives you full control.

admin-on-rest with passport.js authentication?

I am wondering why I cannot find any AOR and passport auth code online? I found a ton of keystone and passport though... Is there a specific reason for that - the two should work well together, right?
You're right, there is no reason admin-on-rest would not work with passport -- however, there is a caveat:
It seems you are searching for a "passport + AOR" tutorial or guide, but one of the selling points of admin-on-rest is that it is truly agnostic to any authentication implementation. Therefore, you would implement a passport strategy of your choosing (jwt, oauth, http basic) within admin-on-rest's authClient.js
https://marmelab.com/admin-on-rest/Authentication.html

Is Waterlock production-ready?

I'm new to Sails.js and stumbled across JWT module called Waterlock. At a glance, it has local and social authentication which are what I'm looking for, which is nice.
However I wonder if this module is production-ready. The last update in Github was long ago and being unmaintained.
If it isn't, is there any production-ready JWT module which does similar to Waterlock available for Sails.js?
Go with Passport.js, Which is stable and if you stuck anywhere there is large community.
Authentication and Permissioning with Sails + Passport
Implement Passport.js authentication with Sails.js

What is the best way to implement user login system for website with hapi.js?

What is the best way to implement user login system for website in hapi.js framework ?
I have searched a lot through the internet but I still don't know which module I should use to implement such authentication. I prefer using passport but the documentation for passport and hapi is so brief. Can anyone suggest me any module? Or a detailed documentation for passport and hapi.js ?
Thank you
If you're looking to do basic authentication, take a look at hapi-auth-basic. Alternately, you may wish to look at hapi-auth-cookie.
If you're looking for third-party login via oAuth there is Bell.
For more on authentication with Hapi take a look at the tutorial on hapijs.com.

Resources