Authentication is one of those things that I've seen almost everybody struggle with. Whether you're using 3rd party services like Firebase Auth or developing your in house solution using something like Passport.js, everyone seems to be reinventing the wheel (although just partially).
I am one of those who tried to build an in-house solution. And after realizing how painful it can be, I decided to turn it into a microservice for anyone to use.
A Quick Introduction
The service itself is written in Golang and use MongoDB for database. It's built using goa (https://github.com/goadesign/goa). It's main purpose is to handle all the things around authentication such as signup and login, token management, session management etc. It uses JWTs as primary authentication mechanism.
It also has support for multiple social-media logins out of the box. These are Google, Instagram, Facebook, LinkedIn, and Twitter. You can selectively choose to use some or all of them or none at all.
It also has a robust logger, and a request rate-limiter as well, which again can be disabled easily if you like.
Using The Service
It is basically an independent microservice that you can fork and modify for any custom features, or just clone and deploy to start using in your projects.
Doesn't matter what client you want to use it with, you can simply use the openapi-generator to generate direct SDKs that take care of most of the implementation details of the service.
For verifying tokens in other backend services, you may simply use the same JWT Public and Private Keys to decode the token and get the claims, or just use the provided endpoint for the same, whichever works better for you.
The steps to setup the service after cloning and running locally are mentioned in the README on GitHub repo.
There are certain things that are still not complete yet, none of them would stop you from using the service though.
TODO:
- Add Tests
- Implement service stubs for Email and SMS
- Add email notifications for user actions
You may find the repo here
Feel free to fork/contribute and use it for your own projects any way you'd like.
P.S. It's my first post on Dev. I've been writing on Medium, but wanted to switch. Find my other blogs here
Top comments (0)