← Back to blog

Authentication for your application

Published at Dec 10, 2024

#authentication

Authentication can be done in many ways these days. You can roll your own using libraries, write it all from scratch, using SaaS providers, or use platform providers like AWS directly.

It’s hard to make a secure authentication system by yourself as there are many things to consider, and if you haven’t made one before, you are in for a lot of reading and researching before you can make a secure solution.

This often leads to developers choosing to use hosted SaaS solutions for authentication. As you can see in our pricing calculator, this can become quite expensive as your user base grows. The cheapest options in our calculator are often platform providers that give you the basics, but leaves a lot of code up to you.

Personally, I prefer to use existing authentication libraries for my project, as I’m then free from the recurring costs of the providers. It’s not much extra code needed compared to the provider solutions, as you typically have to set up CRUD for your users in your database anyways.

Libraries like Auth.js and Lucia has made this a lot easier the last couple of years, and typically you would use these libraries to connect to social OAuth providers like Facebook, Google, Github etc for the authentication. You simply get a response back from the login action, and you decide what to do with the information in the response, like creating the user or setting the user status as logged in in your system, be it via database sessions or JWT tokens.

If email and password solutions are necessary for your project, I would probably go for a paid provider solution. I wouldn’t want to store the passwords myself in the database, as we have seen so many data breaches leaking passwords on the internet. And I for sure don’t want to be part of such an event. The auth providers had dedicated teams for securing their solutions, and I trust them more than my own knowledge in this vast domain.

Some prefer the magic link login methods, but I personally don’t like to get all these emails. Remember that you have to set up the email solution yourself in many cases, and the running costs for emails has to be counted in the total cost. You can check prices for transactional email in one of our other calculators here.

Only some of the SaaS auth providers listed in our calculator offers organizations in their solutions. This is often crucial for offering users to login to the same shared accounts in your solution. Note that organizations often triple (or more) the prices of the auth service from the providers. Organizations is something you could make yourself outside of the provider, and I would recommend coding this yourself, and simply only use the providers for the authentication per user.

Remember that authentication is only checking that the user is who they say they are, it does not cover the whole authorization part. Authorization is the action of checking if the user has access to do what they are trying to do. Very few of the providers in our calculator offer authorization along with the authentication system.