You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When creating new credentials with new refresh_token, you set is_access_token_expired to False, and than it doesn't save it to the json file path. so one repeats generating new credentials over and over again.
In file credentials.py added after the first if statement:
def validate_token(self) -> None:
"""Validates the access token and refresh token.
### Overview
----
A TD Ameritrade Access token is only valid for 30 minutes,
and a TD Ameritrade Refresh token is only valid for 90 days.
When an access token expires, a new one is retrieved using the
refresh token. If the refresh token is expired the oAuth workflow
starts again.
"""
if self.is_refresh_token_expired:
print("Refresh Token Expired, initiating oAuth workflow...")
self.from_workflow()
# save to json file
if self._loaded_from_file:
self.to_credential_file(file_path=self._file_path)
if self.is_access_token_expired:
print("Access Token Expired, refreshing access token...")
token_dict = self.grab_access_token()
self.from_token_dict(token_dict=token_dict)
if self._loaded_from_file:
self.to_credential_file(file_path=self._file_path)
The text was updated successfully, but these errors were encountered:
leassaf
changed the title
not saving new credentials file to path when generating new refresh_token
Not saving new credentials file to path when generating new refresh_token
Mar 27, 2022
When creating new credentials with new
refresh_token
, you setis_access_token_expired
toFalse
, and than it doesn't save it to the json file path. so one repeats generating new credentials over and over again.In file
credentials.py
added after the first if statement:The text was updated successfully, but these errors were encountered: