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

token_login() method doesn't change the logged_in attribute and doesn't verify a token #169

Open
skokovsergey opened this issue Nov 26, 2024 · 0 comments

Comments

@skokovsergey
Copy link

I see 2 issues with token_login() method

  1. token_login() method doesn't change logged_in attrubte to true. As a result, the token won't be refreshed in run() method.
  2. token_login() method doesn't verify token expiration or refresh it. I would expect an exception if the token had expired (without refreshToken) or if an error happened during refresh.
    def token_login(self, token, refresh_token=None):
        token_json = {
            "token": token,
            "refreshToken": refresh_token,
        }

        self.__save_token(token_json)
        self.__load_configuration()

    def run(self):
        self.stopped = False
        while not self.stopped:
            try:
                check_time = time()
                if check_time >= self.token_info["exp"] and self.logged_in:
                    if self.token_info["refreshToken"]:
                        self.refresh()
                    else:
                        logger.error("No username or password provided!")
                sleep(1)
            except Exception as e:
                logger.exception(e)
                break
            except KeyboardInterrupt:
                break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant