Simple web application written in Go to proxy the OAuth authorization code flow with GitHub in order to prevent a leak of the client secret for frontend applications. This application then could be hosted on something like GCP Functions or similar.
This project is work in progress and generally more like a experiment to me in order to learn Go.
- Create a new OAuth app on GitHub: https://github.com/settings/applications/new
- Create a Client secret
- Duplicate
sample.env
and name it.env
- Add your Client ID and secret to your
.env
file - Run the application:
go run .
- The the URL of your frontend to the
.env
file - On the interface of your frontend, point a link to
http://localhost:8080/authorize
- Clicking this link will now redirect your user to GitHub, let them sign in and then redirect them to your frontend. GitHub's response including the access token will be passed as base64 encoded query parameter called
token
.
docker run --env-file .env -p 8080:8080 simonknittel/go-oauth-proxy:latest
docker run --env-file .env -p 8080:8080 public.ecr.aws/simonknittel/go-oauth-proxy:latest