# \[Laravel\] Logout User with OpenID

**URL:** <https://devforum.okta.com/t/laravel-logout-user-with-openid/13337>\
**Category:** Questions\
**Created:** [March 14, 2021, 7:06pm UTC](https://devforum.okta.com/t/laravel-logout-user-with-openid/13337 "2021-03-14T19:06:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kburkhart](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/kburkhart/32/2724_2.png) [@Kburkhart](https://devforum.okta.com/u/Kburkhart)\
**Post date:** [March 14, 2021, 7:06pm UTC](https://devforum.okta.com/t/laravel-logout-user-with-openid/13337/1 "2021-03-14T19:06:17Z")

</div>

I find myself stuck and in need of a little help.

I’m integrating Okta into a Laravel 8 application, however, while the /logout route will end the local user session, they are automatically logged in again with the Okta service.

I’m using Laravel 8 with the socialite-Okta service provider. Logging in works great, I’m just not able to logout successfully.

I’ve even tried adding an HTTP request to the logout function in the Auth/Login controller to kill the token session both with logout and revoke endpoints but no luck their either.

Has anyone had any luck handling a successful Okta logout in a Laravel app?

Thank you!!!

---

<div class="post-metadata">

**Author:** ![gpadma](https://avatars.discourse-cdn.com/v4/letter/g/858c86/32.png) [@gpadma](https://devforum.okta.com/u/gpadma)\
**Post date:** [March 18, 2021, 8:57pm UTC](https://devforum.okta.com/t/laravel-logout-user-with-openid/13337/2 "2021-03-18T20:57:54Z")

</div>

@Kburkhart,

Do you know if Laravel calls the [/logout](https://developer.okta.com/docs/reference/api/oidc/#logout) endpoint of Okta?

This endpoint takes an ID token and logs the user out of Okta if the subject matches the current Okta session.

---

<div class="post-metadata">

**Author:** ![st3forpresident](https://avatars.discourse-cdn.com/v4/letter/s/77aa72/32.png) [@st3forpresident](https://devforum.okta.com/u/st3forpresident)\
**Post date:** [September 29, 2021, 10:37pm UTC](https://devforum.okta.com/t/laravel-logout-user-with-openid/13337/3 "2021-09-29T22:37:42Z")

</div>

Can you elaborate:

1. Where should the `ID token` come from? Is this the same token that is given when a user logs into OKTA?
2. What is `subject` in the context of `if the subject matches`
3. Is the `Okta session` the same as the `sid`? And if so, should the `sid` be saved and shown in the `applications` tab of a google chrome browser?

Thank you.

---

<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:** [October 11, 2021, 4:05pm UTC](https://devforum.okta.com/t/laravel-logout-user-with-openid/13337/4 "2021-10-11T16:05:55Z")

</div>

1. id\_token\_hint value is the _raw_ JWT string for the ID token issued during user login
2. the subject is the user. So if the user that is currently logged into Okta on the browser matches the id token sent to the logout endpoint, then the call will succeed. Aka, you cannot use the logout endpoint in a different browser than the one the user is currently logged in on, this endpoint is used to remove the Okta session cookie and won’t work otherwise
3. the ‘sid’ cookie represents the Okta session, yes. Once logout is called and succeeds, you will no longer see the “sid” cookie on the Okta domain (until the user logs into Okta again)

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/oktadev/original/1X/589c4c5f80de422d01f47cee7185a7fb8227835c.png) [@system](https://devforum.okta.com/u/system)\
**Post date:** [February 10, 2024, 1:02am UTC](https://devforum.okta.com/t/laravel-logout-user-with-openid/13337/5 "2024-02-10T01:02:19Z")

</div>

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
