- Go to the Developer settings
- Create Application
- Enable
User permissions
->Email addresses
->Read Only
in the Permissions - Generate secret token
- Enter the
URIs
that are allowed to be redirect-URIs (e.g.https://localhost:8080/oauth/github/callback
) - Paste both
Client ID
andClient Secret
to thegithub_secret.json
- Go to the Google Cloud Console
- Create project (add content to the consent screen like title and logo) or use existing
Credentials
->Create Credentials
->Oauth Client ID
- Choose the
Web Application
type and give it a name - Enter the
URIs
that are allowed to be redirect-URIs (e.g.https://localhost:8080/oauth/google/callback
) - Paste both
Client ID
andClient Secret
to thegoogle_secret.json
- Go to the Gmail Settings
- Enable
IMAP
in the Forwarding IMAP/POP - Enable Less secure apps Access
OPTIONAL
- Generate an App Password for mail access
FROM May 30, 2022
- Paste the
mail
and thepassword
to the config
Server is ready immediately after containers are up
SMTP_PASSWORD="mail_password" docker-compose up
-
Port
:6380
Passwordpassword
Database0
-
Port
:5431
Userserver
Passwordpg_password
Databaseauth_example
It is possible to additionally configure the app using environment variables
environment:
POSTGRES_IP: 127.0.0.1 # connect to local database
HOST_PORT: 8082 # change server port
migrate -database ${POSTGRESQL_URL} -path migrate/ up
migrate -database ${POSTGRESQL_URL} -path migrate/ down
git clone https://github.com/illiafox/go-auth.git auth
cd auth
make build
make run # /cmd/server/bin
server -http
server -config config.toml -log log.txt
Available keys can be found in config structure tags
POSTGRES_PORT=4585 server -env
In addition to the terminal output, logs are also written to the file
# Terminal
20/05/2022 10:50:20 | info Initializing repository
20/05/2022 10:50:20 | info Done {"time": 0.012092004}
20/05/2022 10:50:20 | info Server started at 0.0.0.0:8080
// File (default log.txt)
{"level":"info","ts":"Fri, 20 May 2022 10:23:52 EEST","msg":"Initializing repository"}
{"level":"info","ts":"Fri, 20 May 2022 10:23:52 EEST","msg":"Done","time":0.015016048}
{"level":"info","ts":"Fri, 20 May 2022 10:23:52 EEST","msg":"Server started at 0.0.0.0:8080"}