Description
Description
I have only external registration allowed on my instance and discord is one of external OAuth providers.
When trying to log in with discord, i get 500:
[6471f32b] router: completed GET for 77.92.241.205:53462, 307 Temporary Redirect in 14.4ms @ auth/oauth.go:844(auth.SignInOAuth)
...rs/web/auth/oauth.go:948:SignInOAuthCallback() [E] [6471f32d] OAuth2 Provider discord returned empty or missing fields: [nickname]
...rs/web/auth/oauth.go:953:SignInOAuthCallback() [E] [6471f32d] CreateUser: OAuth2 Provider discord returned empty or missing fields: [nickname]
[6471f32d] router: completed GET for 77.92.241.205:53462, 500 Internal Server Error in 400.4ms @ auth/oauth.go:883(auth.SignInOAuthCallback)
I tried setting run mode to debug and log level to trace, didnt get anything useful.
Relevant parts of config:
[service]
REGISTER_EMAIL_CONFIRM = false
ENABLE_NOTIFY_MAIL = false
DISABLE_REGISTRATION = true
ALLOW_ONLY_EXTERNAL_REGISTRATION = true
ENABLE_CAPTCHA = false
REQUIRE_SIGNIN_VIEW = false
AUTO_WATCH_NEW_REPOS = false
[openid]
ENABLE_OPENID_SIGNIN = true
ENABLE_OPENID_SIGNUP = false
[oauth2_client]
ENABLE_AUTO_REGISTRATION = true
Setting oauth2_client.USERNAME
to "userid"
partially solves it, user can be registered:
[6471f55c] router: completed GET for 77.92.241.205:56364, 307 Temporary Redirect in 21.9ms @ auth/oauth.go:844(auth.SignInOAuth)
[6471f55e] router: completed GET for 77.92.241.205:56364, 303 See Other in 446.0ms @ auth/oauth.go:883(auth.SignInOAuthCallback)
...rs/web/auth/oauth.go:920:SignInOAuthCallback() [E] [6471f55e-2] UserSignIn: could not find a matching session for this request
[6471f55e-2] router: completed GET for 77.92.241.205:56364, 500 Internal Server Error in 12.2ms @ auth/oauth.go:883(auth.SignInOAuthCallback)
[6471f55f] router: completed GET for 77.92.241.205:56364, 303 See Other in 55.9ms @ user/avatar.go:48(user.AvatarByEmailHash)
[6471f557-53] router: polling GET for 77.92.241.205:56364, elapsed 3931.0ms @ events/events.go:18(events.Events)
I get another 500 page but user is created and seem to work fine after going to main page. userid
setting locks user's username to discord id which is undesirable and it also affects other OAuth providers.
Full name field is correctly set to discord account name this way though.
Note that i am creating new user. This email does not exist in gitea so no account linking happens, this is registration
Gitea Version
1.19.3
Can you reproduce the bug on the Gitea demo site?
No
Log Gist
No response
Screenshots
No response
Git Version
No response
Operating System
No response
How are you running Gitea?
Compiled from source
Database
SQLite