View Source Tesla.Middleware.BasicAuth (tesla v1.7.0)
Basic authentication middleware.
examples
Examples
defmodule MyClient do
use Tesla
# static configuration
plug Tesla.Middleware.BasicAuth, username: "user", password: "pass"
# dynamic user & pass
def new(username, password, opts \\ %{}) do
Tesla.client [
{Tesla.Middleware.BasicAuth, Map.merge(%{username: username, password: password}, opts)}
]
end
end
options
Options
:username
- username (defaults to""
):password
- password (defaults to""
)