# Cannot log out a non-Keycloak authentication

**URL:** <https://forum.keycloak.org/t/cannot-log-out-a-non-keycloak-authentication/12655>\
**Category:** Securing applications\
**Tags:** authentication\
**Created:** [December 16, 2021, 3:29pm UTC](https://forum.keycloak.org/t/cannot-log-out-a-non-keycloak-authentication/12655 "2021-12-16T15:29:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![prashantch80](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/prashantch80/32/3910_2.png) [@prashantch80](https://forum.keycloak.org/u/prashantch80)\
**Post date:** [December 16, 2021, 3:29pm UTC](https://forum.keycloak.org/t/cannot-log-out-a-non-keycloak-authentication/12655/1 "2021-12-16T15:29:04Z")

</div>

I have spring boot application with embedded UI angular application. Application is using keycloak spring boot adapter.

I am getting exception below from my application, if I logout after access token expired.

> 2021-Dec-16 14:18:17.992 WARN [https-jsse-nio-8080-exec-5] o.k.a.s.a.KeycloakLogoutHandler - Cannot log out a non-Keycloak authentication: org.springframework.security.authentication.AnonymousAuthenticationToken@cf204d47: Principal: anonymousUser; Credentials: [PROTECTED]; Authenticated: true; Details: org.springframework.security.web.authentication.WebAuthenticationDetails@fffed504: RemoteIpAddress: 127.0.0.1; SessionId: F1B069D9C731DF372D3B5E74364F0417; Granted Authorities: ROLE\_ANONYMOUS

My settings

- Access Token Lifespan - 1 Minutes
- SSO Session Idle - 5 Minutes

If I logout before access token lifespan it works fine.

On logout from UI I clears the refresh token and access token from ui app and call the logout which calls the request.logout() and forward to the logout page. on calling logout I am getting exception above.

If I click on login link , It directly opens the application.
