# `AttestoPhoenix.AuthorizationServer.Revocation`
[🔗](https://github.com/XukuLLC/attesto_phoenix/blob/v5.0.0/lib/attesto_phoenix/authorization_server/revocation.ex#L1)

OAuth 2.0 Token Revocation (RFC 7009), as conn-free core.

Validates the required `"token"` parameter, revokes the refresh token and its
descendant family bound to the authenticated `client_id` via
`Attesto.Revocation`, and returns the `:token_revoked` audit event as data.

Only refresh tokens are revocable. A presented access token is handled like
an unknown token and stays valid until it expires, and access tokens already
issued from a revoked refresh family are not invalidated. See
`AttestoPhoenix.Controller.RevocationController` for the reasoning.

# `fetch_token`

```elixir
@spec fetch_token(map()) :: {:ok, String.t()} | {:error, :invalid_request}
```

Extract the required `"token"` parameter from `params`.

# `revoke`

```elixir
@spec revoke(
  AttestoPhoenix.Config.t(),
  String.t() | nil,
  String.t(),
  String.t() | nil,
  keyword()
) ::
  {:ok, [AttestoPhoenix.Event.t()]}
```

Revoke `token` (bound to `client_id`) in `store` and return `{:ok, [event]}`.

---

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