21zoo Labs - Assorted Stuff

Use Gitea as a Auth Provider for oauth2_proxy

Posted — Feb 17, 2020

To use Gitea as a provider with the oauth2_proxy use this config:


authenticated_emails_file = "./emails.txt"
redirect_url = "https://<< host running opauth2_proxy >>/oauth2/callback"
cookie_secret = "<< cookie secret"
provider = "github"

provider_display_name = "Gitea"

client_id = "<< client_id as generated by Gitea >>"
client_secret = "<< client_secret as generated by Gitea >>"

login_url="https://<< your gitea host >>/login/oauth/authorize"
redeem_url="https://<< your gitea host >>/login/oauth/access_token"
validate_url="https://<< your gitea host >>/api/v1"

upstreams = [
  "http://<< upstream host >>:<< port >>"

and emails.txt contains a list of emails that you allow access to, like this:

[email protected]
[email protected]

And then run:

./oauth2_proxy -config=proxy.cfg