# `WardrikOAuth.Device`

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

# `poll`

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

The result of one poll.

# `t`

```elixir
@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.

# `next_interval`

```elixir
@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`

```elixir
@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.

# `request`

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

Requests a code for the principal to enter.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
