# `AshAi.Mcp.OAuth.Pending`
[🔗](https://github.com/ash-project/ash_ai/blob/v1.5.6/lib/ash_ai/mcp/oauth/pending.ex#L5)

An authorization in progress, from `AshAi.Mcp.OAuth.authorize_url/3` until
`AshAi.Mcp.OAuth.handle_callback/3`.

It holds the PKCE `code_verifier`, which is a secret, and the `issuer`
recorded from the authorization server's validated metadata, which the
callback checks the response's `iss` against (RFC 9207).

`owner` is stored as given, so it must be JSON-safe for `to_map/1` to be.

# `t`

```elixir
@type t() :: %AshAi.Mcp.OAuth.Pending{
  client_id: String.t(),
  code_verifier: String.t(),
  created_at: DateTime.t(),
  iss_parameter_supported: boolean(),
  issuer: String.t(),
  owner: term(),
  redirect_uri: String.t(),
  resource: String.t(),
  scope: String.t() | nil,
  server_url: String.t(),
  state: String.t(),
  token_endpoint: String.t()
}
```

# `from_map`

```elixir
@spec from_map(map()) :: t()
```

Builds a pending authorization from a map produced by `to_map/1`.

# `to_map`

```elixir
@spec to_map(t()) :: map()
```

Converts the pending authorization to a JSON-safe map with string keys.

---

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