Exemplo n.º 1
0
def refresh_token(api_key_refresh):
    authenticator = oauth.SimpleOAuthAuthenticator(
        server_url=paths.get_bkit_url(), client_id=CLIENT_ID, ports=PORTS)
    auth_token, refresh_token = authenticator.get_refreshed_token(
        api_key_refresh)
    if auth_token is not None and refresh_token is not None:
        tasks_queue.add_task((write_tokens, (auth_token, refresh_token)))
Exemplo n.º 2
0
def login(signup, url, r_url):
    authenticator = oauth.SimpleOAuthAuthenticator(server_url=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()
Exemplo n.º 4
0
def refresh_token(api_key_refresh, url):
    authenticator = oauth.SimpleOAuthAuthenticator(server_url=url,
                                                   client_id=CLIENT_ID,
                                                   ports=PORTS)
    auth_token, refresh_token, oauth_response = authenticator.get_refreshed_token(
        api_key_refresh)
    if auth_token is not None and refresh_token is not None:
        tasks_queue.add_task(
            (write_tokens, (auth_token, refresh_token, oauth_response)))
    return auth_token, refresh_token, oauth_response