# How works logout

**URL:** <https://devforum.okta.com/t/how-works-logout/13965>\
**Category:** Questions\
**Created:** [April 26, 2021, 2:53pm UTC](https://devforum.okta.com/t/how-works-logout/13965 "2021-04-26T14:53:52Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ebarrera](https://avatars.discourse-cdn.com/v4/letter/e/ad7895/32.png) [@ebarrera](https://devforum.okta.com/u/ebarrera)\
**Post date:** [April 26, 2021, 2:53pm UTC](https://devforum.okta.com/t/how-works-logout/13965/1 "2021-04-26T14:53:52Z")

</div>

Hi Friends,

This is my first SSO implementation, using okta documentation we were able to do logout, however if the user tryies to login again, our program don’t request okta credentials again, our program show immediatelly the first page of the system. My question is: If when the user logout, okta system replied with an “OK”, in the logout, why this behaviour? Is working logout? What can we expect when logout an user?

Thank for in advance for any answer

---

<div class="post-metadata">

**Author:** ![tyty](https://avatars.discourse-cdn.com/v4/letter/t/35a633/32.png) [@tyty](https://devforum.okta.com/u/tyty)\
**Post date:** [April 26, 2021, 3:01pm UTC](https://devforum.okta.com/t/how-works-logout/13965/2 "2021-04-26T15:01:21Z")

</div>

Hi there! How exactly are you logging out? Are you using any SDK in particular?

---

<div class="post-metadata">

**Author:** ![ebarrera](https://avatars.discourse-cdn.com/v4/letter/e/ad7895/32.png) [@ebarrera](https://devforum.okta.com/u/ebarrera)\
**Post date:** [April 26, 2021, 9:46pm UTC](https://devforum.okta.com/t/how-works-logout/13965/3 "2021-04-26T21:46:15Z")

</div>

Hi tyf,

I am not using any sdk, I send directly the get to my endpoint, the endpoint response is “ok”, but the user session stills alive.

Best regards

---

<div class="post-metadata">

**Author:** ![tyty](https://avatars.discourse-cdn.com/v4/letter/t/35a633/32.png) [@tyty](https://devforum.okta.com/u/tyty)\
**Post date:** [April 26, 2021, 10:00pm UTC](https://devforum.okta.com/t/how-works-logout/13965/4 "2021-04-26T22:00:17Z")

</div>

Thanks for clarifying - Please check out the following post regarding logging a user out/clearing sessions:

> [@My Application is still accessible even after logging out of Okta](https://devforum.okta.com/t/my-application-is-still-accessible-even-after-logging-out-of-okta/10783/2):
>
> @Suchina.N Did you clear Okta session when you logout? Here is a way to delete the user’s all sessions and you can implement it when you call logout function. Revoke and clear session and token The sessions endpoints can be used to logout a user and also revoke all tokens associated with the user: DELETE: /api/v1/users/ ${userId} /sessions?oauthTokens=true [https://developer.okta.com/docs/reference/api/users/#user-sessions](https://developer.okta.com/docs/reference/api/users/#user-sessions) The api collections can also be found in the above link. userId is…

---

<div class="post-metadata">

**Author:** ![ebarrera](https://avatars.discourse-cdn.com/v4/letter/e/ad7895/32.png) [@ebarrera](https://devforum.okta.com/u/ebarrera)\
**Post date:** [April 28, 2021, 2:42pm UTC](https://devforum.okta.com/t/how-works-logout/13965/5 "2021-04-28T14:42:31Z")

</div>

Hi tyty,

Thanks for you answer. I have been trying to follow your advise, however until now, I was unable to delete user session, please help me with these queations:

1. How can we get the userID, we can see this value when we validate token, but cannot get it.
2. In some documentation parts, We saw that we need to send a header “Autorization: SSWS api\_token”, how can we get the api\_token?

Thanks in advance

---

<div class="post-metadata">

**Author:** ![tyty](https://avatars.discourse-cdn.com/v4/letter/t/35a633/32.png) [@tyty](https://devforum.okta.com/u/tyty)\
**Post date:** [April 28, 2021, 4:53pm UTC](https://devforum.okta.com/t/how-works-logout/13965/6 "2021-04-28T16:53:28Z")

</div>

No problem! Happy to help 😀

1. You can get the user id from the current session: [Sessions | Okta Developer](https://developer.okta.com/docs/reference/api/sessions/#get-current-session)
2. You can create an API token in your Okta Org: [Overview | Okta Developer](https://developer.okta.com/docs/guides/create-an-api-token/overview/)

---

<div class="post-metadata">

**Author:** ![ebarrera](https://avatars.discourse-cdn.com/v4/letter/e/ad7895/32.png) [@ebarrera](https://devforum.okta.com/u/ebarrera)\
**Post date:** [May 4, 2021, 3:23pm UTC](https://devforum.okta.com/t/how-works-logout/13965/7 "2021-05-04T15:23:08Z")

</div>

Hi tyty,

Thanks for your help, let me tell that we were able to do the logout and we was able to revoke the user sesión, now if the user tries to login to the system, the system request to capture user/passsword, the problem is that using valid credential okta replies: “Your login was unsuccessful. PLease try again” Do you know what is the reason for this behaviour? Why okta does not accept valid credentials? If the user close the browser everything works fine.

Thanks in advance

---

<div class="post-metadata">

**Author:** ![andrea](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/andrea/32/2172_2.png) [@andrea](https://devforum.okta.com/u/andrea)\
**Post date:** [February 7, 2024, 12:33am UTC](https://devforum.okta.com/t/how-works-logout/13965/8 "2024-02-07T00:33:56Z")

</div>


