{"id":26128021,"url":"https://github.com/ilivestrong/auth-service","last_synced_at":"2026-05-30T22:31:59.772Z","repository":{"id":239014534,"uuid":"797817228","full_name":"ilivestrong/auth-service","owner":"ilivestrong","description":"An authentication service depicting a user login flow, otp generation in an event-driven manner using a message broker.","archived":false,"fork":false,"pushed_at":"2024-05-09T15:10:35.000Z","size":44,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-05-10T14:14:26.558Z","etag":null,"topics":["authentication","event-driven","golang","rabbitmq"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ilivestrong.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-08T15:17:30.000Z","updated_at":"2024-06-19T07:39:17.000Z","dependencies_parsed_at":"2024-05-09T14:14:19.971Z","dependency_job_id":"57e9f765-855c-4533-b445-0822b441970d","html_url":"https://github.com/ilivestrong/auth-service","commit_stats":null,"previous_names":["ilivestrong/auth-service"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ilivestrong/auth-service","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilivestrong%2Fauth-service","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilivestrong%2Fauth-service/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilivestrong%2Fauth-service/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilivestrong%2Fauth-service/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ilivestrong","download_url":"https://codeload.github.com/ilivestrong/auth-service/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilivestrong%2Fauth-service/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33712579,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-30T02:00:06.278Z","response_time":92,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["authentication","event-driven","golang","rabbitmq"],"created_at":"2025-03-10T18:50:13.289Z","updated_at":"2026-05-30T22:31:59.747Z","avatar_url":"https://github.com/ilivestrong.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# auth-service\n\n## About this service\n\nThis service is written in `Golang` and uses `Connect Framework` to create the RPCs. The protos are compiled using `Buf`. The Go code interacts with other components like `PostgreSQL` database for persiting profiles and events and `RabbmitMQ` to allow auth-service to interact with otp-service in an event-driven fashion.\n\n## RPCs implemented\n- **SignupWithPhoneNumber** - This RPC allows a person to signup with their phone number. If successful, an event is sent to RabbitMQ exchange. The listener OTP service then consume the event and uses Twilio to send a 6 digit OTP sms to the phone number.  \n\n- **VerifyPhoneNumber** - Upon receivng an OTP, this RPC can be used to verify the user's phone number and their OTP.  \n\n- **LoginWithPhoneNumber** - Once phone number is verified, this RPC can be used to login into the service. Upon successful login, the service returns back a JWT auth token.  This token is required to invoke - \"GetProfile\" and \"Logout\" RPCs as they both are secured APIs.  \n\n- **GetProfile** - A logged-in user can invoke this RPC to see their profile details. User must provide an authorization bearer header with token received in in Login step.  \n\n- **Logout** - A user can end their session but invoking this RPC, this would invalidate the current JWT token.  \n\n\n## Configure service dependencies\n\nWe first need to  configure below required components:\n\n### Database\nThis service uses PostgreSQL database, so run an instance of PG database as standalone installation or inside docker container.  \nAs an example, below command can be used to run PostgreSQL container. *Make sure you have Docker installed locally*  \n\n```sh\ndocker run --name postgresdb -v pg-data:/var/lib/postgresql/data -p 5432:5432 -e POSTGRES_PASSWORD=postgres -d postgres\n```\n\n`NOTE: Upon running PG instance, please create a database named 'midas'. If you want any other name, make sure to update it accordingly in the \".env\" file as shown below in .env section.`  \n\n\n### RabbitMQ\nThis service also uses RabbitMQ to produce and consume service events to communicate with otp-service. So run an instance preferably inside a docker container.  As an example, below command can be used to run RabbitMQ container. *Make sure you have Docker installed locally*  \n\n```sh\ndocker run -it --rm --name rabbitmq -p 5672:5672 -p 15672:15672 rabbitmq:3.13-management\n```\n\n### .env  \nOpen the .env file in the root of the `auth-service` folder and enter below required PostgreSQL and RabbitMQ config details.  \n\n`AMQP_ADDRESS` - This is RabbitMQ local running URL containing its host, user/password and port.  \n\n`DB-*` - All keys starting with `DB-` are PostgreSQL details. The `Port` is the PG running port.  \n\n`TOKEN_EXPIRY_IN_MINUTES` - This is validity `in minutes` of the token you generate in the Login step.\n\n```sh\nAMQP_ADDRESS=amqp://guest:guest@localhost:5672/\nDB_HOST=localhost\nDB_NAME=midas\nDB_USERNAME=postgres\nDB_PASSWORD=postgres\nDB_PORT=5432\nPORT=8080\nTOKEN_EXPIRY_IN_MINUTES=20\n```\n\n## Run the service \nTo run the service we need to install Go dependencies i.e., third-party packages used. CD into the root of the project directory. And run below commands sequentially:\n\n**Install dependencies**\n```sh\ngo mod download\n```\n**Then, run :**\n```sh\ngo run main.go\n```  \n\nIf everything setup correctly, you will see something like this:\n![alt text](image.png)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Filivestrong%2Fauth-service","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Filivestrong%2Fauth-service","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Filivestrong%2Fauth-service/lists"}