View Source Tesla.Middleware.BasicAuth (tesla v1.13.2)

Basic authentication middleware.

Wiki on the topic

Examples

defmodule MyClient do
  def client(username, password, opts \ %{}) do
    Tesla.client([
      {Tesla.Middleware.BasicAuth,
        Map.merge(%{username: username, password: password}, opts)}
    ])
  end
end

Options

  • :username - username (defaults to "")
  • :password - password (defaults to "")