# `HaAuth.HA.OAuth`
[🔗](https://github.com/drselump14/ha_auth/blob/v0.1.0/lib/ha_auth/ha/oauth.ex#L1)

Home Assistant's OAuth2 (IndieAuth flavour): no client registration, the
app's base URL is the `client_id` and the redirect URI is on the same
host. See https://developers.home-assistant.io/docs/auth_api/

The browser goes to `:auth_url`; the code exchange, user lookup and
revoke go server-side to `:ha_url`. The HA tokens are revoked as soon as
the user is known. Swap in a stub with `config :ha_auth, :oauth, Mod`.

# `authorize_url`

```elixir
@callback authorize_url(
  client_id :: String.t(),
  redirect_uri :: String.t(),
  state :: String.t()
) ::
  String.t()
```

# `sign_in`

```elixir
@callback sign_in(code :: String.t(), client_id :: String.t()) ::
  {:ok, map()} | {:error, term()}
```

# `impl`

The configured implementation (this module unless stubbed).

---

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