# Logout with custom identity provider

**URL:** <https://forum.keycloak.org/t/logout-with-custom-identity-provider/9174>\
**Category:** Getting advice\
**Created:** [May 21, 2021, 12:32pm UTC](https://forum.keycloak.org/t/logout-with-custom-identity-provider/9174 "2021-05-21T12:32:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nidaff](https://avatars.discourse-cdn.com/v4/letter/n/e495f1/32.png) [@nidaff](https://forum.keycloak.org/u/nidaff)\
**Post date:** [May 21, 2021, 12:32pm UTC](https://forum.keycloak.org/t/logout-with-custom-identity-provider/9174/1 "2021-05-21T12:32:01Z")

</div>

I am using my identity provider to get access token for users in remote database. And it works good  
I am getting token and requests work only with this token  
But when i trying logout by this way  
[http://auth-server/auth/realms/{realm-name}/protocol/openid-connect/logout](http://auth-server/auth/realms/%7Brealm-name%7D/protocol/openid-connect/logout)  
This return 200 ok  
But if i am do request with token of user who just logout, request works and return result, but i am expecting 401 error  
Can someone help me?

---

<div class="post-metadata">

**Author:** ![gmesml](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/gmesml/32/2664_2.png) [@gmesml](https://forum.keycloak.org/u/gmesml)\
**Post date:** [May 25, 2021, 9:49am UTC](https://forum.keycloak.org/t/logout-with-custom-identity-provider/9174/2 "2021-05-25T09:49:56Z")

</div>

Hey there,

it seems that there’s a lack of context of how you’re performing and which end you’re performing the logout.

If you’re developing a web app or something similar the natural way to perform the logout would be using keycloak’s official client and from its instance perform `keycloak.logout();`

However if you’re trying to handle the session your own way maybe consider revoking the token as someone else was trying to perform the task in this thread: [Revoking offline token as the client](http://forum.keycloak.org/t/revoking-offline-token-as-the-client/9161)

Hope you solve the matter 🙂
