def prepare_auth_params_json(bot, manifest):
  """Returns a dict to put into JSON file passed to task_runner.

  This JSON file contains various tokens and configuration parameters that allow
  task_runner to make HTTP calls authenticated by bot's own credentials.

  The file is managed by bot_main.py (main Swarming bot process) and consumed by
  task_runner.py.

  It lives it the task work directory.

  Args:
    bot: instance of bot.Bot.
    manifest: dict with the task manifest, as generated by the backend in /poll.
  """
  return {
    'swarming_http_headers': bot.remote.get_authentication_headers(),
    'task_service_account': manifest.get('service_account') or 'none',
  }