Has anyone built their own authentication system?
11–20 of 26 posts
Re: Has anyone built their own authentication system?
#12Yes, several. This is going to be a controversial one... but it isn't nearly as difficult as people make it seem. You shouldn't roll your own crypto libraries, but storing a bcrypt hash of the users password in the database, and then creating a JWT and setting it in a cookie, or create a session table and store a UUID in the cookie as a key to the session table really isn't that difficult. Personally I think the prob…
Re: Has anyone built their own authentication system?
#13It was pretty boring and grinding. For a personal site, I’d use something off the shelf for sure.
Re: Has anyone built their own authentication system?
#14Yes, several. This is going to be a controversial one... but it isn't nearly as difficult as people make it seem. You shouldn't roll your own crypto libraries, but storing a bcrypt hash of the users password in the database, and then creating a JWT and setting it in a cookie, or create a session table and store a UUID in the cookie as a key to the session table really isn't that difficult. Personally I think the prob…
Bonus points, store meta data about the hash algorithm. That way if you ever need to change it in the future due to a weakness in the algorithm you can validate the password against old metadata and rehash with new metadata and update the record.
Re: Has anyone built their own authentication system?
#15*difficult not as in "hard to implement", more as in "lots of moving parts, hard to maintain"
Re: Has anyone built their own authentication system?
#16Re: Has anyone built their own authentication system?
#17For a simple website JWTs are almost definitely an overkill (you would get all the drawbacks for none of the benefits). A session based authentication with some libs from your ecosystem for the crypto parts and a nice intro on how to combine them together could be the perfect thing for you.
Re: Has anyone built their own authentication system?
#18Earlier quoted context omitted.
Bonus points, store meta data about the hash algorithm. That way if you ever need to change it in the future due to a weakness in the algorithm you can validate the password against old metadata and rehash with new metadata and update the record.
Many of the popular password hashes include metadata in the default output already. bcrypt certainly does.
Re: Has anyone built their own authentication system?
#19For a simple website JWTs are almost definitely an overkill (you would get all the drawbacks for none of the benefits). A session based authentication with some libs from your ecosystem for the crypto parts and a nice intro on how to combine them together could be the perfect thing for you.
I have always found jwt easier to deal with than session based authentication.
Of course downside is that once you move to multiserver you have to think of setting up sticky loadbalancing or distributed sessions.
Re: Has anyone built their own authentication system?
#20Even better nowadays, there are multiple SaaS/starter kits you can use (most are paid) that remove all these chores and you can get down to your domain flow.