Macfly.Discharge (macfly v0.2.14)

Summary

Functions

Attempts to perform the next step in the discharge protocol. The caller should check the state between calls to next(). Terminal states are :success and :error. For :user_interactive, the caller is responsible for redirecting the user to the user_url before calling next() again.

Types

@type error() ::
  {:error, :failed, HTTPoison.Error.t()}
  | {:error, integer(),
     String.t() | {:bad_response, term()} | {:bad_json, String.t(), term()}}
@type state() ::
  :init
  | {:poll, String.t()}
  | {:user_interactive, String.t(), String.t()}
  | {:success, String.t()}
  | error()
@type t() :: %Macfly.Discharge{
  auth: map(),
  id: binary(),
  location: URI.t(),
  state: state(),
  ticket: binary() | nil
}

Functions

@spec next(%Macfly.Discharge{
  auth: term(),
  id: term(),
  location: term(),
  state: state(),
  ticket: term()
}) ::
  %Macfly.Discharge{
    auth: term(),
    id: term(),
    location: term(),
    state: state(),
    ticket: term()
  }

Attempts to perform the next step in the discharge protocol. The caller should check the state between calls to next(). Terminal states are :success and :error. For :user_interactive, the caller is responsible for redirecting the user to the user_url before calling next() again.

Link to this function

with_bearer_auth(d, hostname, token)