steampy icon indicating copy to clipboard operation
steampy copied to clipboard

Session Not Terminating on Logout Request

Open borisenko09 opened this issue 10 months ago • 0 comments

Issue Description We are experiencing an issue with the logout() function where the session does not terminate after making a logout request. Despite calling the logout endpoint, the session ID remains valid and subsequent requests (e.g., fetching wallet balance) are still successful, indicating that the session is still active. Temporary Workaround As a temporary workaround, we have implemented a method to explicitly clear the session cookies after the logout request. This method can be added to the SteamClient class:

def clear_session_cookies(self):
    self._session.cookies.clear_session_cookies()

This method should be called immediately after the logout attempt to ensure the client-side session is cleared:

@login_required
    def logout(self) -> None:
        url = f'{SteamUrl.COMMUNITY_URL}/login/logout/'
        data = {'sessionid': self._get_session_id()}
        self._session.post(url, data=data)

        if self.is_session_alive():
            self.clear_session_cookies()
            raise Exception('Logout unsuccessful')

        self.was_login_executed = False

borisenko09 avatar Apr 18 '24 20:04 borisenko09