Skip to content

Authentication Service with Firebase Admin integration

Notifications You must be signed in to change notification settings

twitter-remake/auth

Repository files navigation

Auth Service

This is the authentication service for the whole twitter clone app. It is made with Golang with Firebase Auth as the authentication SaaS.

For now, it just syncs the user data from Firebase Auth to the postgres database.

Motivation

Authentication and authorization are essential for any microservices architecture. They ensure that only authorized users can access the services, and that they can only access the resources that they are allowed to access.

Implementing your own authentication flow can be complex and time-consuming. This is especially true if you need to support a variety of authentication methods, such as username and password, OAuth, and social login.

Hence, I decided to use Firebase Auth as the authentication SaaS for this project.

Some other alternatives that I might consider in the future are AWS Cognito and Supabase Auth.

Setting up Dev environment

Here you will understand how to run and setup the development environment for the auth service in your local machine.

Prerequisites

1. Protobuf

First, you need to generate the protobuf files using buf protobuf cli tool. You can do this by running the following command:

cd proto
buf generate --debug --verbose

This command will generate the protobuf files in the gen/{lang=go}/{service} directory.

Next, There is an init.sql file, so next is to execute the queries in the file to create the tables.

2. Local Docker

Head to github.com/twitter-remake/compose for the docker-compose file and instructions.

3. Configuration

Create the .env file by copying the .env.example file and fill in the values.

Next is to create the firebase-credentials.json file which you can get from the firebase console Settings > Service Accounts > Generate new private key.

4. Run the service

go run main.go

Support

If you have any questions or feedback, feel free to contact me via email

And if you like this project, consider buying me a coffee :) ko-fi

About

Authentication Service with Firebase Admin integration

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages