owlauth-client 0.7.0

Rust Project Auth client for OwlAuth
Documentation
# OwlAuth Runtime SDK for Rust

`owlauth-client` is the Beta, asynchronous client for OwlAuth Project Auth. Run it on Tokio; it uses reqwest for HTTP.

```sh
cargo add owlauth-client
cargo add tokio --features macros,rt-multi-thread
```

## Start login

Replace the example IDs and key with your Project and Application values. Use your Application's registered callback URL. Construct the client once and run the handlers on your application's Tokio runtime (for example, a binary with `#[tokio::main]`).

```rust
use owlauth_client::{Client, ClientConfig, OwlAuthError, PendingLogin, SessionTokens};

fn new_client() -> Result<Client, OwlAuthError> {
    Client::new(ClientConfig::new(
        "https://auth.example.com",
        "owl_prj_example",
        "owl_app_example",
        "owl_pk_example",
    ))
}

async fn start_login(client: &Client) -> Result<PendingLogin, OwlAuthError> {
    client.start_login("https://app.example.com/auth/callback").await
}
```

Store the returned pending record securely for that browser before redirecting it to `pending.hosted_url`.

## Handle callback

Pass the full incoming callback URL and the pending record held for that browser. Consume that record once, validate the callback, and exchange the handoff. Store the returned tokens in your application session before using `current_user(&access_token)`.

```rust
async fn handle_callback(
    client: &Client,
    callback_url: &str,
    pending: PendingLogin,
) -> Result<SessionTokens, OwlAuthError> {
    client.complete_login(callback_url, &pending).await
}
```

`complete_login()` validates and exchanges in one call. Use the exported `validate_callback()` helper and `client.exchange_handoff()` to handle those steps separately. If you pass only a query string, your application must verify the callback origin and path.

## Sessions and transport

Use `get_config()` for public sign-in configuration and `get_jwks()` for signing keys. Serialize refresh requests and replace both tokens returned by `refresh(&refresh_token)` together.

`logout(&access_token)` revokes the Application session. For hosted browser logout, use `prepare_browser_logout(&access_token, redirect_uri)` with a registered redirect URI while the Application session is active. Send the same browser to `hosted_url` and let the user confirm. Keep the Application session active through confirmation; confirmed browser logout invalidates its linked sessions. Clear your local session on return.

Requests default to 10 seconds (`ClientConfig::timeout`) and a 1 MiB response limit. The SDK follows no redirects and sends no cookies. Set `config.allow_insecure_http = true` with a loopback base such as `http://127.0.0.1:8080` for local development. Use `Client::with_transport` to inject a transport.

`OwlAuthError` exposes `code`, `status`, `message`, `request_id`, and `retryable`. Check the outcome before retrying an ambiguous handoff or refresh. `Debug` hides sensitive fields; Serde serialization includes them, so protect the serialized data.

See the [Runtime SDK guide](https://owlauth-docs.owlfoundry.org/guide/sdks).