Open cmoulliard opened 1 year ago
Hi, I saw you solved your problem on the Discord channel. Is it okay to close it?
We can close it but nevertheless it should be great to send back as response a more user friendly message !
So what's the bug? I'm also confused about why this happened.
The error was not at all related to the message returned :-(
We cannot create a user using a TOKEN but instead the username/password of the ADMIN user. So this request should work
curl -k -X 'POST' \
"$GITEA_API_URL/v1/admin/users" \
-H 'accept: application/json' \
-u "gitea_admin:gitea_admin" \
-H 'Content-Type: application/json' \
-d '{
"email": "user1@cnoe.io",
"full_name": "user1",
"login_name": "user1",
"must_change_password": false,
"password": "user11234",
"restricted": false,
"visibility": "public",
"send_notify": false,
"username": "user1"
}'
It's your fault, this is not a bug,It's not replace $TOKEN
by real token in the curl command.
it works when repalce -H 'Authorization: token $TOKEN' \
with -H "Authorization: token $TOKEN" \
May be i can improve the error info.
it works when repalce
Simple quote should be replaced by double quotes :-)
May be i can improve the error info.
Yes please as the message is not related at all to what the root cause is
I think for security reasons it should not be modified. Because the error message will be too detailed.
Then the error message should be authentication failed instead of
"user does not exist [uid: 0, name: , keyid: 0]`
Agree
Description
Issue
New user cannot be created using curl and Swagger API as we got as response
user does not exist [uid: 0, name: , keyid: 0]
Command executed:
Gitea Version
1.20.5-rootless
Can you reproduce the bug on the Gitea demo site?
No
Log Gist
2023/10/19 16:26:51 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/v1/admin/users for 10.244.0.6:46502, 401 Unauthorized in 0.3ms @ auth/middleware.go:39(auth.APIAuth)
Screenshots
No response
Git Version
2.40.1
Operating System
macos
How are you running Gitea?
Here is how I installed gitea
persistence: enabled: false
gitea: admin: username: "gitea_admin" password: "gitea_admin" email: "gi@tea.com" config: database: DB_TYPE: sqlite3 session: PROVIDER: memory cache: ADAPTER: memory queue: TYPE: level
service: ssh: type: NodePort nodePort: 32222 externalTrafficPolicy: Local
ingress: enabled: true className: nginx hosts:
Database
SQLite