Skip to content

Commit

Permalink
When a session is retired, make sure to also clear access token (#1105)
Browse files Browse the repository at this point in the history
Refs #1090
  • Loading branch information
ecederstrand authored Aug 9, 2022
1 parent 5b6656d commit f73143c
Showing 1 changed file with 6 additions and 2 deletions.
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

0 comments on commit f73143c

Please sign in to comment.