Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When a session is retired, make sure to also clear access token #1105

Merged
merged 2 commits into from
Aug 9, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions exchangelib/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,12 @@ def release_session(self, session):
session = self.renew_session(session)
self._session_pool.put(session, block=False)

@staticmethod
def close_session(session):
def close_session(self, session):
if isinstance(self.credentials, OAuth2Credentials) and not isinstance(
self.credentials, OAuth2AuthorizationCodeCredentials
):
# Reset token if client is of type BackendApplicationClient
self.credentials.access_token = None
session.close()
del session

Expand Down