# \_auth\_base

This is the shared contract for all auth providers.

{% tabs %}
{% tab title="End users" %}

### What it defines

* `AuthManifest`: what the UI needs to render auth inputs
* `AuthStatus`: connected/disconnected state returned to the UI
* `AuthProvider` (Protocol): required methods providers must implement

### Why it matters

If a provider follows this contract, it can plug into:

* the auth registry
* the UI “Connect” flow
* config persistence
  {% endtab %}

{% tab title="Power users" %}

### Code map

* `providers/auth/_auth_base.py`

### Expected provider methods

* `manifest()`
* `start(cfg, redirect_uri=...)`
* `finish(cfg, payload=...)`
* `refresh(cfg)` (optional depending on provider)
* `disconnect(cfg)`

<details>

<summary>Flow (diagram)</summary>

```mermaid
sequenceDiagram
  participant UI as UI/API
  participant Auth as Auth Provider
  participant Ext as External Service
  participant CFG as config.json

  UI->>Auth: manifest()
  UI->>Auth: start(cfg, redirect_uri)
  Auth->>Ext: request device/PIN or oauth step
  Auth-->>UI: code / url / polling hints
  UI->>Auth: finish(cfg, payload)
  Auth->>Ext: exchange code/token
  Auth->>CFG: save tokens/secrets
  Auth-->>UI: AuthStatus (connected)
```

</details>
{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wiki.crosswatch.app/blueprint-architecture/auth/_auth_base.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
