Now I know why people always say: “don’t roll your own authentication system.” Unless you want to create an authentication system for fun, I would advise against it.
First of all, it’s a full-time job to create a robust authentication system. For example, you need many API routes, knowledge of encryption, a server to host the API, and a database server. That is just the minimum. Authentication systems are much more complicated than they seem.
You also need to keep up with security patches for your authentication systems application dependencies. Also, you need to keep up with the dependencies of the software you are using to build your application.
Another reason to avoid creating an authentication system is that there are already great ones available. Just take your pick:
- Google Login
- Facebook Login
- Twitter Login
- Github Login
All of these applications can be used as an authentication system for your application for minimal cost or free.
For me, I’ve always wanted to write an authentication system from scratch, and so I have written a few. It is a good idea to create an authentication system as a programming exercise, but you should use an existing authentication system for a production application.
The two reason to create your own authentication system:
- Programming exercise
- You want to build an authentication SaaS product.
To conclude, you should “roll-your-own auth.” It’s usually very complex, there are many security dependencies to worry about, and there are already great solutions available. So build your application and integrate it with an existing authentication system. You’ll thank me later!