go-oauth2-backend

module
v0.0.0-...-392719a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 29, 2024 License: MIT

README

Go OAuth2 Backend

Go Report Card

This is a simple backend written in Go that uses OAuth2 to authenticate users with Discord and Google. It can be extended to support other OAuth2 providers.

Environment Variables

Copy the .env.example file to .env and fill in the values or set the environment variables manually.

General
  • PORT - Port to run the application
  • APP_URL - Application URL (with port if needed) (used for redirecting)
Database
  • DB_HOST - Database host
  • DB_PORT - Database port
  • DB_DATABASE - Database name
  • DB_USERNAME - Database username
  • DB_PASSWORD - Database password
OAuth2
  • DISCORD_CLIENT_ID - Discord OAuth2 client ID
  • DISCORD_CLIENT_SECRET - Discord OAuth2 client secret
  • GOOGLE_CLIENT_ID - Google OAuth2 client ID
  • GOOGLE_CLIENT_SECRET - Google OAuth2 client secret

MakeFile

Build the application

make build

Run the application

make run

Create DB container

make docker-run

Shutdown DB container

make docker-down

Live reload the application

make watch

Clean up binary from the last build

make clean

Directories

Path Synopsis
cmd
app
internal
api
utils/color
https://twin.sh/articles/35/how-to-add-colors-to-your-console-terminal-output-in-go
https://twin.sh/articles/35/how-to-add-colors-to-your-console-terminal-output-in-go
utils/cookies
https://www.alexedwards.net/blog/working-with-cookies-in-go
https://www.alexedwards.net/blog/working-with-cookies-in-go

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL