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
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
@type poll() :: {:ok, WardrikOAuth.Token.t()} | :pending | :slow_down | {:retry, term()} | {:error, term()}
The result of one poll.
@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
@spec next_interval(poll(), non_neg_integer()) :: non_neg_integer()
Returns milliseconds to wait before the next poll. Adds 5 seconds after :slow_down.
@spec poll(WardrikOAuth.Metadata.t(), WardrikOAuth.Provider.t(), t(), keyword()) :: poll()
Polls the token endpoint once to see if the principal has entered the code.
@spec request(WardrikOAuth.Metadata.t(), WardrikOAuth.Provider.t(), keyword()) :: {:ok, t()} | {:error, term()}
Requests a code for the principal to enter.