Authentication Through Gitea

Overview

One of the login options for dex uses the Gitea OAuth2 flow to identify the end user through their Gitea account.

When a client redeems a refresh token through dex, dex will re-query Gitea to update user information in the ID Token. To do this, dex stores a readonly Gitea access token in its backing datastore. Users that reject dex’s access through Gitea will also revoke all dex clients which authenticated them through Gitea.

Configuration

Register a new OAuth consumer with Giteaensuring the callback URL is (dex issuer)/callback. For example if dex is listening at the non-root path https://auth.example.com/dex the callback would be https://auth.example.com/dex/callback.

The following is an example of a configuration for examples/config-dev.yaml:

  1. connectors:
  2. - type: gitea
  3. # Required field for connector id.
  4. id: gitea
  5. # Required field for connector name.
  6. name: Gitea
  7. config:
  8. # Credentials can be string literals or pulled from the environment.
  9. clientID: $GITEA_CLIENT_ID
  10. clientSecret: $GITEA_CLIENT_SECRET
  11. redirectURI: http://127.0.0.1:5556/dex/callback
  12. # optional, default = https://gitea.com
  13. baseURL: https://gitea.com