td-ameritrade-python-api icon indicating copy to clipboard operation
td-ameritrade-python-api copied to clipboard

grab_access_token vs grab_refresh_token

Open Aspire1Inspire2 opened this issue 4 years ago • 0 comments

Hi @areed1192, thank you for your explanation in issue #133. However, I noticed that in your _token_validation function, you did the following:

        if self._token_seconds(token_type='access_token') < nseconds and self.config['refresh_enabled']:
            self.grab_refresh_token()

It seems that you are meant to check the expiration of access token and grab a new one? However, you grab refresh token after determine that the access token is expiring.

There is no other place you grab a refresh token other than "login" and this place.

I would recommend you check the expiration of both access token and refresh token and grab a new one separately for both of them. Could you check and determine if this is a valid issue in the code? Thanks.

Aspire1Inspire2 avatar Dec 17 '20 12:12 Aspire1Inspire2