Authentication service, which provide multiple authentication providers
Code structure is based on the Golang-Project-Structure
- Install
protobuf compiler
:
sudo apt-get -y install protobuf-compiler
- Install Google protobuf for Golang:
go get -u github.com/golang/protobuf/{proto,protoc-gen-go}
App should be located near configuration file config.yml
.
Example file can be found in repo's config.yml
.
All auth providers secrets are stored in the secrets
folder.
For creating OAuth2 secrets, follow steps:
- Go to Google API console
- Create project
- Add
OAuth 2.0 Client IDs
creadentials - Add scopes for getting user profile info:
https://www.googleapis.com/auth/userinfo.email
https://www.googleapis.com/auth/userinfo.profile
- Add redirecting URL, which is link to your server API. (example:
http://localhost:9000
)
Google OAuth2 secrets should be downloaded as JSON file from Google API console.
For linting we are using golangci-lint
To run this we recomend use Docker:
docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:v1.40-alpine golangci-lint run
Before pull request, please run test.sh
script from the scripts
folder for checking errors.
After executing test.sh
file coverage.out
with code coverage statistic will be generated.
For view this file in HTML format use:
go tool cover -html=coverage.out
For running use:
go run .
For building docker container use:
sh scripts/build_docker.sh
For deploy app with docker run script in docker
folder:
docker-compose up -d