WardrikOAuth.Device (wardrik_oauth v0.1.0-rc.1)

Copy Markdown

Device sign-in (RFC 8628): the principal enters a code on any device.

Summary

Types

The result of one poll.

t()

The code the server gave and where to enter it.

Functions

Returns milliseconds to wait before the next poll. Adds 5 seconds after :slow_down.

Polls the token endpoint once to see if the principal has entered the code.

Requests a code for the principal to enter.

Types

poll()

@type poll() ::
  {:ok, WardrikOAuth.Token.t()}
  | :pending
  | :slow_down
  | {:retry, term()}
  | {:error, term()}

The result of one poll.

t()

@type t() :: %WardrikOAuth.Device{
  device_code: String.t(),
  expires_in: pos_integer(),
  interval: non_neg_integer(),
  user_code: String.t(),
  verification_uri: String.t()
}

The code the server gave and where to enter it.

Functions

next_interval(arg1, interval_ms)

@spec next_interval(poll(), non_neg_integer()) :: non_neg_integer()

Returns milliseconds to wait before the next poll. Adds 5 seconds after :slow_down.

poll(metadata, provider, device, req_options)

Polls the token endpoint once to see if the principal has entered the code.

request(metadata, provider, req_options)

@spec request(WardrikOAuth.Metadata.t(), WardrikOAuth.Provider.t(), keyword()) ::
  {:ok, t()} | {:error, term()}

Requests a code for the principal to enter.