Add oauth via CLI fails to add some parameters #9534

Closed
opened 2025-11-02 08:42:07 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @Leptopoda on GitHub (Sep 7, 2022).

Description

Couldn't find an existing issue so posting here:
As oidc config via env vars isn't implemented yet I scripted a command to add the oauth to my server:

➜  git git:(master) ✗ docker compose exec server \
  gitea admin auth add-oauth \
  --name "Test Auth" \
  --provider "openidConnect" \
  --key "redacted" \
  --secret "redacted" \
  --auto-discover-url "https://auth.redacted.tld/application/o/gitea/.well-known/openid-configuration" \
  --icon-url "https://auth.redacted.tld/static/dist/assets/icons/icon.png" \
  --skip-local-2fa "true" \
  --scopes "email profile" \
  --group-claim-name "groups" \
  --admin-group "admin" \
  --restricted-group "guest"
2022/09/07 22:20:01 ...e/cli@v1.22.9/app.go:524:HandleAction() [I] [SQL] SELECT "id", "type", "name", "is_active", "is_sync_enabled", "cfg", "created_unix", "updated_unix" FROM "login_source" WHERE (name=$1) LIMIT 1 [Test Auth] - 5.959803ms
2022/09/07 22:20:01 ...bce556200f/engine.go:1210:Insert() [I] [SQL] INSERT INTO "login_source" ("type","name","is_active","is_sync_enabled","cfg","created_unix","updated_unix") VALUES ($1,$2,$3,$4,$5,$6,$7) RETURNING "id" [OAuth2 Test Auth true false {"Provider":"openidConnect","ClientID":"redacted","ClientSecret":"redacted","OpenIDConnectAutoDiscoveryURL":"https://auth.redacted.tld/application/o/gitea/.well-known/openid-configuration","CustomURLMapping":null,"IconURL":"https://auth.redacted.tld/static/dist/assets/icons/icon.png","Scopes":[],"RequiredClaimName":"","RequiredClaimValue":"","GroupClaimName":"","AdminGroup":"","RestrictedGroup":"","SkipLocalTwoFA":true} 1662582001 1662582001] - 13.832394ms

The problem is that everything after the 2fa stuff isn't added (according to the UI). This includes scopes/groups/custom claims.

So opening the UI those settings are unpopulated/empty. The INSERT command (last line) also doesn't show them so my guess is that they aren't populated in the first place.

Even in dev mode the logs don't show anything after running the command so there isn't a log attached but let me know if I should get one.

Gitea Version

docker latest-rootless (currently 1.17.2)

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

docker

Operating System

docker

How are you running Gitea?

gitea docker rootless latest with postgres

Database

PostgreSQL

Originally created by @Leptopoda on GitHub (Sep 7, 2022). ### Description Couldn't find an existing issue so posting here: As oidc config via env vars isn't implemented yet I scripted a command to add the oauth to my server: ``` ➜ git git:(master) ✗ docker compose exec server \ gitea admin auth add-oauth \ --name "Test Auth" \ --provider "openidConnect" \ --key "redacted" \ --secret "redacted" \ --auto-discover-url "https://auth.redacted.tld/application/o/gitea/.well-known/openid-configuration" \ --icon-url "https://auth.redacted.tld/static/dist/assets/icons/icon.png" \ --skip-local-2fa "true" \ --scopes "email profile" \ --group-claim-name "groups" \ --admin-group "admin" \ --restricted-group "guest" 2022/09/07 22:20:01 ...e/cli@v1.22.9/app.go:524:HandleAction() [I] [SQL] SELECT "id", "type", "name", "is_active", "is_sync_enabled", "cfg", "created_unix", "updated_unix" FROM "login_source" WHERE (name=$1) LIMIT 1 [Test Auth] - 5.959803ms 2022/09/07 22:20:01 ...bce556200f/engine.go:1210:Insert() [I] [SQL] INSERT INTO "login_source" ("type","name","is_active","is_sync_enabled","cfg","created_unix","updated_unix") VALUES ($1,$2,$3,$4,$5,$6,$7) RETURNING "id" [OAuth2 Test Auth true false {"Provider":"openidConnect","ClientID":"redacted","ClientSecret":"redacted","OpenIDConnectAutoDiscoveryURL":"https://auth.redacted.tld/application/o/gitea/.well-known/openid-configuration","CustomURLMapping":null,"IconURL":"https://auth.redacted.tld/static/dist/assets/icons/icon.png","Scopes":[],"RequiredClaimName":"","RequiredClaimValue":"","GroupClaimName":"","AdminGroup":"","RestrictedGroup":"","SkipLocalTwoFA":true} 1662582001 1662582001] - 13.832394ms ``` The problem is that everything after the 2fa stuff isn't added (according to the UI). This includes scopes/groups/custom claims. So opening the UI those settings are unpopulated/empty. The INSERT command (last line) also doesn't show them so my guess is that they aren't populated in the first place. Even in dev mode the logs don't show anything after running the command so there isn't a log attached but let me know if I should get one. ### Gitea Version docker latest-rootless (currently 1.17.2) ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version docker ### Operating System docker ### How are you running Gitea? gitea docker rootless latest with postgres ### Database PostgreSQL
GiteaMirror added the type/question label 2025-11-02 08:42:07 -06:00
Author
Owner

@techknowlogick commented on GitHub (Sep 9, 2022):

IIRC urfave/cli (the CLI library we use) requires something like --blah-blah=true (note, the =) for bools.

I'm going to close this, but if that doesn't work please feel free to re-open.

@techknowlogick commented on GitHub (Sep 9, 2022): IIRC `urfave/cli` (the CLI library we use) requires something like `--blah-blah=true` (note, the `=`) for bools. I'm going to close this, but if that doesn't work please feel free to re-open.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#9534