Tesla.Middleware.BearerAuth (tesla v1.4.3) View Source

Bearer authentication middleware.

Adds a {"authorization", "Bearer <token>"} header.

Examples

defmodule MyClient do
  use Tesla

  # static configuration
  plug Tesla.Middleware.BearerAuth, token: "token"

  # dynamic token
  def new(token) do
    Tesla.client [
      {Tesla.Middleware.BearerAuth, token: token}
    ]
  end
end

Options

  • :token - token (defaults to "")