Description
First off, thanks for a great product so far!
- Gitea version (or commit ref): 1.9.3
- Git version: 1.8.3.1
- Operating system: CentOS 7 (really a Docker container running in OpenShift)
- Database (use
[x]
):- PostgreSQL
- MySQL
- MSSQL
- SQLite
- Can you reproduce the bug at https://try.gitea.io:
- Yes (provide example URL)
- No
- Not relevant
- Log gist: mentioned in description below
Description
The most straightforward way to reproduce this IMO is:
- Deploy Gitea 1.9.3 however you like
- Use the CLI reference to create an OAuth2 authentication source
- For example
gitea admin auth add-oauth --name keycloakoidc --provider openidConnect --key gitea --secret <MY-GITEA-CLIENT-SECRET> --auto-discover-url http://<MY-KEYCLOAK-DOMAIN>/auth/realms/<MY-KEYCLOAK-REALM>/.well-known/openid-configuration --config=/home/gitea/conf/app.ini
- Also reproducible with other providers, like gitlab, ex.
/home/gitea/gitea admin auth add-oauth --name gitlab --provider gitlab --key gitea --secret <MY-GITEA-CLIENT-SECRET> --custom-auth-url https://gitlab.com/oauth/authorize --custom-token-url https://gitlab.com/oauth/token --custom-profile-url https://gitlab.com/api/v3/user --config=/home/gitea/conf/app.ini
These commands both succeed and you get the appropriate Sign in with
buttons appearing on the sign in page, as shown below:
However, clicking on this link immediately gives a 500 error (screenshot below):
The server logs don't produce much more there, just
[Macaron] 2019-10-02 17:02:02: Completed GET /user/oauth2/gitlab 500 Internal Server Error in 7.243256ms
.
However : if you had DISABLE_REGISTRATION = false
in your app.ini
, and at this point you register as a local (non-external) user with admin privileges through the UI, and then go to Site Administration->Authentication Sources
, click to edit the authentication source that you just created through the CLI, and just click update (no changes whatsoever, see below)
Then you will notice that if you sign out and go back to the sign in page, then clicking the Sign in with
Gitlab button works, it takes you out to Gitlab.com instead of returning a 500.
In summary, as the title of this issue suggests, creating OAuth2 authentication sources through the CLI requires a manual, one-time intervention through the UI to make them work. In most cases this isn't a big deal, but it's a showstopper if you're trying to automate the deployment of Gitea. Thanks!