def connect():
    global connected
    global kickflip_session
    global KICKFLIP_CLIENT_ID
    global KICKFLIP_CLIENT_SECRET
    global KICKFLIP_API_URL

    if not connected:

        endpoint = KICKFLIP_BASE_URL + '/o/token/'

        payload = ({
            'client_secret': KICKFLIP_CLIENT_SECRET,
            'grant_type': 'client_credentials',
            'client_id': KICKFLIP_CLIENT_ID,
            })

        response = requests.post(endpoint, payload)

        if response.status_code != 200:
            raise Exception("Error: Couldn't connect to Kickflip...")

        token = response.json()

        client = MobileApplicationClient(KICKFLIP_CLIENT_ID)

        kickflip_session = OAuth2Session(
            KICKFLIP_CLIENT_ID,
            client=client,
            token=token
        )

        connected = True
        print "CONNECTED"

    return connected