OIDC 사용자가 기존 Discourse 사용자와 연결되지 않음

Hi! I’m trying to set up Discourse with the Discourse OpenID Connect plugin and Keycloak.

I’ve managed to make it work, and was able to not only login to my Discourse instance using my Keycloak credentials, but also associate an already-existing Discourse account with the one from OIDC. Unfortunately, I made a mistake when setting up the Keycloak container and I ended up losing its configuration and database.

I’ve since reinstalled Keycloak (properly this time!) and reconfigured Discourse to use the new Client ID, but while it seems that the integration is working (enabling the logs in /logs shows that the authentication actually worked), I can’t seem to associate Discourse accounts with OIDC accounts anymore.

When I try to log into Discourse, I use OIDC, am greeted by the new account UI, and then click the link to associate with an already existing account; I log in, am redirected to Discourse, and if I log out and log in again, I see the same new account UI.

I used the Data Explorer plugin to look at associations, and my user shows up as NULL; the provider ID matches the User ID in Keycloak, though.

I have the “OpenID Connect allow association change” option turned on.

I imagine that Discourse is still hanging onto whatever was there from my previous Keycloak installation, and just changing the new Client ID isn’t doing the trick.

Is there something else I should look into that I may have overlooked?

Cheers

Are you using the same email address between the accounts? Can you reproduce this issue with a fresh account that wasn’t associated with Keycloak before?

Thanks for the quick response!

I wasn’t using the same email address between the accounts, but I’ve changed it on Keycloak to match the one used in Discourse, and it’s still the same. The response in Data Explorer is the same (“NULL” user).

I tried creating a new, fresh user, and I’m getting a “Invalid username, email or password” error, even though the username is perfectly fine and available, the email is valid, and the password has been generated by my password manager. This is most likely unrelated but it’s something else I need to figure out why it’s happening.

안녕하세요,

저도 같은 문제를 겪고 있습니다. 저는 Nextcloud를 OIDC 제공자로 사용하고 있습니다. 다만 이 문제는 해당 사항과 무관할 가능성이 높습니다.

Nextcloud 로그인을 통해 로그인할 수 있습니다. 그런 다음 위에 설명한 대로 기존 계정으로 로그인하거나 새 계정을 등록할 수 있는 선택지가 제공됩니다. 그러나 이메일 주소를 통해 기존 계정과 연결이 이루어지지 않습니다.

"등록"을 선택하면 즉시 로그아웃된 상태의 시작 페이지로 돌아가며, 다시 로그인해야 합니다. 오류 메시지는 표시되지 않습니다.

꽤 이상하네요.

해당 OIDC 계정에 일치하는 Discourse 계정이 없는 경우, 모든 것이 정상적으로 작동합니다. 그러면 새 계정이 바로 생성되고, 사용자 설정에서 연결된 계정도 표시됩니다.

혹시 제가 잘못하고 있는 부분이 있는지, 아니면 여기 버그가 있는 건지 아이디어를 주실 분이 있을까요?

감사합니다

Mike

안녕하세요,

할당 기능이 작동하지 않던 이유를 찾아냈습니다. 같은 문제를 겪고 계신 분들을 위해 제 해결 방법을 공유합니다.

전달된 이메일 주소는 기본적으로 "인증됨"으로 표시되지 않습니다. 이를 해결하기 위해 관리자 영역에서 OpenID Connect 제공자 → 설정으로 이동하여 “토큰에 이메일 주소 인증 정보 포함” 값을 "항상 확인됨으로 설정"으로 변경했습니다.