# Keycloak doesn't log out when logging out of DHIS2

**URL:** <https://community.dhis2.org/t/keycloak-doesnt-log-out-when-logging-out-of-dhis2/52803>\
**Category:** Support - Assistance technique\
**Tags:** interoperability\
**Created:** [12 April 2023 08:31 UTC](https://community.dhis2.org/t/keycloak-doesnt-log-out-when-logging-out-of-dhis2/52803 "2023-04-12T08:31:14Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anh\_Tran](https://dhis2.b-cdn.net/user_avatar/community.dhis2.org/anh_tran/32/38947_2.png) [@Anh\_Tran](https://community.dhis2.org/u/Anh_Tran)\
**Post date:** [12 April 2023 08:31 UTC](https://community.dhis2.org/t/keycloak-doesnt-log-out-when-logging-out-of-dhis2/52803/1 "2023-04-12T08:31:14Z")

</div>

Hi  
Could you share the DHIS2 and Keycloak integration configuration document with me, please? I am having the following issue:

```auto
INFO 2023-04-12T10:55:45,676 Authentication event AuthenticationFailureBadCredentialsEvent ip 172.16.31.199 sessionId 2bfea153ac2acaa70dea038988af0d8bd13711697ca7afdb278a2c748f480b2c exception could_not_map_oidc_user_to_dhis2_user Failed to look up DHIS2 user with OidcUser mapping mappingClaimKeyemail claim valuetest1gmail.com (AuthenticationLoggerListener.java [http-nio-8080-exec-9]) ID7CPsxv1W4+TM5fjWivneXaQ9UCjRK7Pg7DfhhXGxqKo=

```

On both the KC and DHIS systems, I have set the email for test1 as [test1@gmail.com]

---

<div class="post-metadata">

**Author:** ![Gassim](https://dhis2.b-cdn.net/user_avatar/community.dhis2.org/gassim/32/35347_2.png) [@Gassim](https://community.dhis2.org/u/Gassim)\
**Post date:** [12 April 2023 21:26 UTC](https://community.dhis2.org/t/keycloak-doesnt-log-out-when-logging-out-of-dhis2/52803/2 "2023-04-12T21:26:06Z")

</div>

Hi @Anh_Tran

I couldn’t find a document specifically for keycloak; however, the documents above are guidelines that should work for the other options too.

It says in the error

> [@Anh\_Tran](#):
>
> `valuetest1gmail.com`

when you are using [test1@gmail.com](mailto:test1@gmail.com) (isn’t that a different address?)

---

<div class="post-metadata">

**Author:** ![jaime.bosque](https://dhis2.b-cdn.net/user_avatar/community.dhis2.org/jaime.bosque/32/42220_2.png) [@jaime.bosque](https://community.dhis2.org/u/jaime.bosque)\
**Post date:** [18 April 2023 14:36 UTC](https://community.dhis2.org/t/keycloak-doesnt-log-out-when-logging-out-of-dhis2/52803/3 "2023-04-18T14:36:50Z")

</div>

Hey @Anh_Tran , did you manage to solve the issue?

---

<div class="post-metadata">

**Author:** ![Anh\_Tran](https://dhis2.b-cdn.net/user_avatar/community.dhis2.org/anh_tran/32/38947_2.png) [@Anh\_Tran](https://community.dhis2.org/u/Anh_Tran)\
**Post date:** [19 April 2023 00:15 UTC](https://community.dhis2.org/t/keycloak-doesnt-log-out-when-logging-out-of-dhis2/52803/4 "2023-04-19T00:15:12Z")

</div>

Hi @jaime.bosque  
Currently, I’m having an issue when log out on DHIS2, but it doesn’t log out on Keycloak. I have configured in dhis.conf “oidc.provider.keycloak.end\_session\_endpoint = [https://mykeycloakdomain/auth/realms/dhis2/protocol/openid-connect/logout](https://mykeycloakdomain/auth/realms/dhis2/protocol/openid-connect/logout)”.

---

<div class="post-metadata">

**Author:** ![jaime.bosque](https://dhis2.b-cdn.net/user_avatar/community.dhis2.org/jaime.bosque/32/42220_2.png) [@jaime.bosque](https://community.dhis2.org/u/jaime.bosque)\
**Post date:** [19 April 2023 07:42 UTC](https://community.dhis2.org/t/keycloak-doesnt-log-out-when-logging-out-of-dhis2/52803/5 "2023-04-19T07:42:03Z")

</div>

In the end I managed to get it working, I just needed to check the option “External Auth only”.

 ![image](https://dhis2.b-cdn.net/uploads/default/original/3X/a/4/a43f63c168ab6fbaa40801e9e8b96d913b9057ee.png)

I am not using the “log out” option.

---

<div class="post-metadata">

**Author:** ![Anh\_Tran](https://dhis2.b-cdn.net/user_avatar/community.dhis2.org/anh_tran/32/38947_2.png) [@Anh\_Tran](https://community.dhis2.org/u/Anh_Tran)\
**Post date:** [19 April 2023 08:13 UTC](https://community.dhis2.org/t/keycloak-doesnt-log-out-when-logging-out-of-dhis2/52803/6 "2023-04-19T08:13:00Z")

</div>

Hi @jaime.bosque  
yes, i have checked it. I thought when select Logout, it would logout the account on Keycloak as well, but mine is not doing so.  
 ![image](https://dhis2.b-cdn.net/uploads/default/original/3X/5/b/5bb639fd1d7184003d577b7bcae7810e4dc95d94.png)
