# iFrame integration, issue logging out users

**URL:** <https://forums.rocket.chat/t/iframe-integration-issue-logging-out-users/1826>\
**Category:** Community Support\
**Created:** [August 13, 2018, 7:07pm UTC](https://forums.rocket.chat/t/iframe-integration-issue-logging-out-users/1826 "2018-08-13T19:07:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidLevi](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/davidlevi/32/678_2.png) [@davidLevi](https://forums.rocket.chat/u/davidLevi)\
**Post date:** [August 13, 2018, 7:07pm UTC](https://forums.rocket.chat/t/iframe-integration-issue-logging-out-users/1826/1 "2018-08-13T19:07:52Z")

</div>

Im facing an issue logging out users.  
I’m using the iFrame integration on my site.  
I use an admin account to get tokens for users to log them in, this way I do not need to deal with passwords.

1. The iFrame API URL isn’t always called. So I cannot return an empty token to signify that the user is not logged in.(Probably cached.)
2. I use the userId and the user auth\_token and call the /api/v1/logout endpoint (vs using the admin token to log them out).

When I try to log out the user calling the end point, even thought I get a status success message, he is still logged into the server.

Maybe Im doing it wrong, but the flow via logs that I took seems to be correct. Everything seems to be working as it should, it’s just the user never actually gets logged out.

Side Note: If I’m able to log users in as an Admin via tokens, shouldn’t I be able to log them out as an Admin? I couldn’t find that endpoint if it exists. As of now I understand that I can get the user token as an Admin, but the user himself needs to logout.

---

<div class="post-metadata">

**Author:** ![davidLevi](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/davidlevi/32/678_2.png) [@davidLevi](https://forums.rocket.chat/u/davidLevi)\
**Post date:** [August 24, 2018, 12:31am UTC](https://forums.rocket.chat/t/iframe-integration-issue-logging-out-users/1826/2 "2018-08-24T00:31:08Z")

</div>

I just wanted to update on how i Fixed this issue that I had. It was an issue with the way that I was doing it. Thank you

There was an issue with users that I was logging in/out with. I guess I expected the Logout endpoint to invalidate all tokens. So while I was logging in with different browsers there were two tokens valid that were registered with the server.

Just for reference I have added the endpoints that I am using for this.

Login:  
Endpoint: _/api/v1/users.createToken_  
Header: X-Auth-Token: _ADMIN\_AUTH\_TOKEN_  
Header: X-User-Id: _ADMIN\_USER\_ID_  
Data: ‘{ “userId”: “_USER\_ID_” }’

Logout:  
Endpoint:\* /api/v1/logout\*  
Header: X-Auth-Token: USER\_AUTH\_TOKEN  
Header: X-User-Id: USER\_ID
