Returned when the controller responds with HTTP 401 or 403.
The raw response :body is not stored — it can leak sensitive
details via Inspect/Logger/Sentry. A scrubbed, truncated
:body_preview (URL/host-like patterns redacted, ≤ 128 chars) is
provided for diagnostics. See UnifiApi.Client.scrub_body_preview/1.
Example
case UnifiApi.Network.Sites.list(client) do
{:ok, sites} ->
handle(sites)
{:error, %UnifiApi.AuthError{reason: :unauthorized}} ->
# API key invalid or expired
:reauth
{:error, %UnifiApi.AuthError{reason: :forbidden}} ->
# API key valid but lacks permission for this resource
:no_access
end