ivar v0.8.0 Ivar.Auth

Ivar.Auth manages the authentication credentials used for a request

Summary

Functions

Puts the given credentials under auth_type into the existing request map

Functions

put(request, credentials, auth_type)
put(map, {tuple | binary}, atom) :: map

Puts the given credentials under auth_type into the existing request map

Args

  • request - the map used to store the credentials, usually created via Ivar.new/2
  • credentials - the credentials to be used for authentication
  • auth_type - an atom for the type of authentication to be used (:basic or :bearer)

Credentials

  • :basic auth tuple - {"username", "password"}
  • :bearer token - "some.token"

Usage

iex> Ivar.Auth.put(%{}, {"user", "pass"}, :basic)
%{auth: {"authorization", "Basic dXNlcjpwYXNz"}}