-
Notifications
You must be signed in to change notification settings - Fork 442
Open
Description
In the docstring for the method token_expiration_datetime it says that the expiration is extended by 3 months if the refresh token is present. As far as I can see, the method do not do this:
python-o365/O365/utils/token.py
Lines 45 to 64 in 2ac7c7e
| def token_expiration_datetime( | |
| self, *, username: Optional[str] = None | |
| ) -> Optional[dt.datetime]: | |
| """ | |
| Returns the current access token expiration datetime | |
| If the refresh token is present, then the expiration datetime is extended by 3 months | |
| :param str username: The username from which check the tokens | |
| :return dt.datetime or None: The expiration datetime | |
| """ | |
| access_token = self.get_access_token(username=username) | |
| if access_token is None: | |
| return None | |
| expires_on = access_token.get("expires_on") | |
| if expires_on is None: | |
| # consider the token has expired | |
| return None | |
| else: | |
| expires_on = int(expires_on) | |
| return dt.datetime.fromtimestamp(expires_on) |
Earlier the code did extend it
python-o365/O365/utils/token.py
Lines 41 to 44 in 02013cd
| expires_on = access_expires_at - dt.timedelta(seconds=EXPIRES_ON_THRESHOLD) | |
| if self.is_long_lived: | |
| expires_on = expires_on + dt.timedelta(days=90) | |
| return expires_on |
Is the current method correct, or am I misunderstanding how it works?
Metadata
Metadata
Assignees
Labels
No labels