UpdateExternalUser failed: external login user link does not exists #9585

Closed
opened 2025-11-02 08:43:45 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @danieldietsch on GitHub (Sep 18, 2022).

Description

I just updated our staging environment from 1.16.9 to 1.17.2. Everything seems fine, but I receive
...rs/web/auth/oauth.go:1045:handleOAuth2SignIn() [E] [6326e27a-2] UpdateExternalUser failed: external login user link does not exists [userID: 3, loginSourceID: 1] in the logs whenever I login via OAuth2. The login itself works as expected, but I fear this may cause issues down the road.
My OAuth2 provider is OpenID Connect via Keycloak.
gitea doctor --all says everythings fine.

The debug log for such a sign-in looks like this:

2022/09/18 11:18:46 ...s/context/context.go:219:HTML() [D] [6326e276] Template: user/auth/signin
2022/09/18 11:18:46 [6326e276] router: completed GET /user/login?redirect_to=%2f for <IP:PORT>, 200 OK in 2.6ms @ auth/auth.go:149(auth.SignIn)
2022/09/18 11:18:50 [6326e27a] router: completed GET /user/oauth2/keycloak for <IP:PORT>, 307 Temporary Redirect in 2.0ms @ auth/oauth.go:775(auth.SignInOAuth)
2022/09/18 11:18:50 ...rs/web/auth/oauth.go:1045:handleOAuth2SignIn() [E] [6326e27a-2] UpdateExternalUser failed: external login user link does not exists [userID: 3, loginSourceID: 1]
2022/09/18 11:18:50 [6326e27a-2] router: completed GET /user/oauth2/keycloak/callback?state=...&session_state=...&code=... for <IP:PORT>, 303 See Other in 15.1ms @ auth/oauth.go:809(auth.SignInOAuthCallback)
2022/09/18 11:18:50 ...s/context/context.go:219:HTML() [D] [6326e27a-3] Template: user/dashboard/dashboard
2022/09/18 11:18:50 [6326e27a-3] router: completed GET / for <IP:PORT>, 200 OK in 4.3ms @ web/home.go:26(web.Home)
2022/09/18 11:18:50 [6326e27a-4] router: completed GET /repo/search?count_only=1&uid=3&team_id=0&q=&page=1&mode= for <IP:PORT>, 0  in 2.7ms @ repo/repo.go:468(repo.SearchRepo)
2022/09/18 11:18:50 [6326e27a-6] router: completed GET /repo/search?sort=updated&order=desc&uid=3&team_id=0&q=&page=1&limit=15&mode=&archived=false for <IP2:PORT>, 200 OK in 1.8ms @ repo/repo.go:468(repo.SearchRepo)
2022/09/18 11:18:52 [6326e27c] router: completed GET / for <IP2:PORT>, 200 OK in 1.1ms @ web/home.go:26(web.Home)
2022/09/18 11:18:52 ...s/context/context.go:219:HTML() [D] [6326e27c] Template: home

Gitea Version

1.17.2

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?

I am running Gitea as docker image gitea/gitea:1.17.2. The DB is mariadb:10.9.2.

Database

MySQL

Originally created by @danieldietsch on GitHub (Sep 18, 2022). ### Description I just updated our staging environment from 1.16.9 to 1.17.2. Everything seems fine, but I receive `...rs/web/auth/oauth.go:1045:handleOAuth2SignIn() [E] [6326e27a-2] UpdateExternalUser failed: external login user link does not exists [userID: 3, loginSourceID: 1]` in the logs whenever I login via OAuth2. The login itself works as expected, but I fear this may cause issues down the road. My OAuth2 provider is OpenID Connect via Keycloak. `gitea doctor --all` says everythings fine. The debug log for such a sign-in looks like this: ``` 2022/09/18 11:18:46 ...s/context/context.go:219:HTML() [D] [6326e276] Template: user/auth/signin 2022/09/18 11:18:46 [6326e276] router: completed GET /user/login?redirect_to=%2f for <IP:PORT>, 200 OK in 2.6ms @ auth/auth.go:149(auth.SignIn) 2022/09/18 11:18:50 [6326e27a] router: completed GET /user/oauth2/keycloak for <IP:PORT>, 307 Temporary Redirect in 2.0ms @ auth/oauth.go:775(auth.SignInOAuth) 2022/09/18 11:18:50 ...rs/web/auth/oauth.go:1045:handleOAuth2SignIn() [E] [6326e27a-2] UpdateExternalUser failed: external login user link does not exists [userID: 3, loginSourceID: 1] 2022/09/18 11:18:50 [6326e27a-2] router: completed GET /user/oauth2/keycloak/callback?state=...&session_state=...&code=... for <IP:PORT>, 303 See Other in 15.1ms @ auth/oauth.go:809(auth.SignInOAuthCallback) 2022/09/18 11:18:50 ...s/context/context.go:219:HTML() [D] [6326e27a-3] Template: user/dashboard/dashboard 2022/09/18 11:18:50 [6326e27a-3] router: completed GET / for <IP:PORT>, 200 OK in 4.3ms @ web/home.go:26(web.Home) 2022/09/18 11:18:50 [6326e27a-4] router: completed GET /repo/search?count_only=1&uid=3&team_id=0&q=&page=1&mode= for <IP:PORT>, 0 in 2.7ms @ repo/repo.go:468(repo.SearchRepo) 2022/09/18 11:18:50 [6326e27a-6] router: completed GET /repo/search?sort=updated&order=desc&uid=3&team_id=0&q=&page=1&limit=15&mode=&archived=false for <IP2:PORT>, 200 OK in 1.8ms @ repo/repo.go:468(repo.SearchRepo) 2022/09/18 11:18:52 [6326e27c] router: completed GET / for <IP2:PORT>, 200 OK in 1.1ms @ web/home.go:26(web.Home) 2022/09/18 11:18:52 ...s/context/context.go:219:HTML() [D] [6326e27c] Template: home ``` ### Gitea Version 1.17.2 ### 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? I am running Gitea as docker image `gitea/gitea:1.17.2`. The DB is `mariadb:10.9.2`. ### Database MySQL
GiteaMirror added the type/bug label 2025-11-02 08:43:45 -06:00
Author
Owner

@flier268 commented on GitHub (Sep 22, 2022):

I had same issue, too.
Version: 1.17.1 & 1.17.2
Database: Sqlite

gitea | 2022/09/22 05:15:24 [632bef6c] router: completed GET /login/oauth/authorize?client_id=e403e45a-acd9-4f75-bf74-38ad9c607e42&redirect_uri=http%3A%2F%2F192.168.2.16%3A3080%2Flogin&response_type=code&state=d5104dc76695721d for 172.18.0.1:52614, 303 See Other in 178.1ms @ auth/oauth.go:356(auth.AuthorizeOAuth)
@flier268 commented on GitHub (Sep 22, 2022): I had same issue, too. Version: 1.17.1 & 1.17.2 Database: Sqlite ``` gitea | 2022/09/22 05:15:24 [632bef6c] router: completed GET /login/oauth/authorize?client_id=e403e45a-acd9-4f75-bf74-38ad9c607e42&redirect_uri=http%3A%2F%2F192.168.2.16%3A3080%2Flogin&response_type=code&state=d5104dc76695721d for 172.18.0.1:52614, 303 See Other in 178.1ms @ auth/oauth.go:356(auth.AuthorizeOAuth) ```
Author
Owner

@emwgit commented on GitHub (Sep 25, 2022):

Hi all, same here.
Versions: 1.16.9 & 1.17.2
Database: sqlite
oauth2 Provider: Nextcloud

@emwgit commented on GitHub (Sep 25, 2022): Hi all, same here. Versions: 1.16.9 & 1.17.2 Database: sqlite oauth2 Provider: Nextcloud
Author
Owner

@wolfogre commented on GitHub (Sep 27, 2022):

Don't worry. It does not affect functionality, and there are no security concerns. It will be fixed ASAP.

@wolfogre commented on GitHub (Sep 27, 2022): Don't worry. It does not affect functionality, and there are no security concerns. It will be fixed ASAP.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#9585