Skip to content

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

Closed
@danieldietsch

Description

@danieldietsch

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions