Go: I use go version ^1.22
Library: I use OAuth2.0 Protocol and Auth0 for my Authentication Server
Gin-Gonic: Because Gin-Gonic is very popular, so there's no reason to not to use this powerful framework
I've implement Clean Architecture design and Factory design pattern. So, you could change my existing Library or framework seamlessly.
Install this project using go
cp .config.example.json config.json
go mod download && go mod tidy
to run this project
go run main.go
to run consumer
go run ./cmd/worker/consumer.go
To run, watch, and build this project
CompileDaemon -command="./go-sso"
To migrate the database
go run ./cmd/migration/main.go
Make sure you fill the required credentials and fill your app name on auth0.go
You could test the SSO using two methods. The first one use JWT and make this repo as Authentication Server. The second one use Auth0 as Third-party Authentication Server.
/api/user/login
Make sure to open it on web browser because it will redirect you to Auth0 login page. And before using this, make sure you add some users on Auth0 platform and add those users to your own database.
/oauth/login?state=your_app_name