Runs the OAuth 2.0 installed application flow.

    Returns:
      An authorized httplib2.Http instance.

def _authenticate(secrets_file):
    """Runs the OAuth 2.0 installed application flow.

    Returns:
      An authorized httplib2.Http instance.
    """
    flow = oauthclient.flow_from_clientsecrets(
        secrets_file,
        scope=OAUTH_SCOPE,
        message=('Failed to initialized OAuth 2.0 flow with secrets '
                 'file: %s' % secrets_file))
    storage = oauthfile.Storage(OAUTH_CREDENTIALS_FILE)
    credentials = storage.get()
    if credentials is None or credentials.invalid:
        credentials = oauthtools.run_flow(flow, storage, oauthtools.argparser.parse_args(args=[]))
    http = httplib2.Http()
    return credentials.authorize(http)