def login_thread(signup=False): r_url = paths.get_oauth_landing_url() url = paths.get_bkit_url() thread = threading.Thread(target=login, args=([signup, url, r_url]), daemon=True) thread.start()
def login(signup): r_url = paths.get_oauth_landing_url() authenticator = oauth.SimpleOAuthAuthenticator( server_url=paths.get_bkit_url(), client_id=CLIENT_ID, ports=PORTS) auth_token, refresh_token = authenticator.get_new_token(register=signup, redirect_url=r_url) utils.p('tokens retrieved') tasks_queue.add_task((write_tokens, (auth_token, refresh_token)))
def login_thread(signup=False): global active_authenticator r_url = paths.get_oauth_landing_url() url = paths.get_bkit_url() authenticator = oauth.SimpleOAuthAuthenticator(server_url=url, client_id=CLIENT_ID, ports=PORTS) #we store authenticator globally to be able to ping the server if connection fails. active_authenticator = authenticator thread = threading.Thread(target=login, args=([signup, url, r_url, authenticator]), daemon=True) thread.start()