コード例 #1
0
ファイル: dropbox.py プロジェクト: instantshare/instantshare
def _authorize():
    authorization_endpoint = "https://www.dropbox.com/oauth2/authorize"
    app_key = CONFIG.get(_name, "app_key")

    # Start OAuth2 implicit flow
    auth_response = implicit_flow(authorization_endpoint, app_key)

    # Check if authorization was successful
    if "error" in auth_response and auth_response["error"] is not None:
        logging.error("Authentication failed. Error message: {0}".format(auth_response["error_description"]))
        return False

    kvstore["access_token"] = auth_response["access_token"]
    kvstore.sync()

    return True
コード例 #2
0
def _authorize():
    authorization_endpoint = "https://www.dropbox.com/oauth2/authorize"
    app_key = config[_name]["app_key"]

    # Start OAuth2 implicit flow
    auth_response = implicit_flow(authorization_endpoint, app_key)

    # Check if authorization was successful
    if "error" in auth_response and auth_response["error"] is not None:
        logging.error("Authentication failed. Error message: {0}".format(
            auth_response["error_description"]))
        return False

    kvstore["access_token"] = auth_response["access_token"]
    kvstore.sync()

    return True
コード例 #3
0
ファイル: imgur.py プロジェクト: instantshare/instantshare
def _authorize():
    # For issue #8
    authorization_endpoint = "https://api.imgur.com/oauth2/authorize"
    client_id = CONFIG.get(_name, "client_id")

    # Start OAuth2 implicit flow
    auth_response = implicit_flow(authorization_endpoint, client_id)

    # Check if authorization was successful
    if "error" in auth_response and auth_response["error"] is not None:
        logging.error("Authentication failed. Error message: {0}".format(auth_response["error_description"]))
        return False

    kvstore["access_token"] = auth_response["access_token"]
    kvstore["refresh_token"] = auth_response["refresh_token"]
    kvstore["expires_in"] = auth_response["expires_in"]
    kvstore.sync()

    return True