The provided content is a **release notes document** for **Logto**, a developer-focused identity platform. It details changes, improvements, bug fixes, and security updates in a specific version (likely **v1.46.0**, based on the changelog link). Below is a **structured summary and explanation** of the key points, organized for clarity and ease of understanding.

---

## 📢 **Overview**
This release focuses on:
- **Security hardening** (especially around SAML, OAuth, and third-party apps)
- **Improved error handling and logging**
- **Better user experience** (sign-in, social login, branding)
- **Stability and performance improvements**
- **Enhanced developer tooling and documentation**

---

## 🔐 **Security Hardening**

### 1. **SAML Assertion Audience**
- **Change**: A SAML assertion is now accepted **only if its `Audience` matches the SP Entity ID** (Audience URI) of the connector.
- **Impact**: After upgrading, if SAML sign-in fails with `"SAML assertion audience does not match the SP entity ID"`, you must:
  - Go to your **Identity Provider (IdP)** settings
  - Set the **Audience** to match the **Audience URI (SP Entity ID)** in Logto’s connector settings
- **Why?** Prevents spoofing and ensures assertions are intended for the correct service.

### 2. **Account API & Third-Party Apps**
- **Change**: All Account API operations now require a **first-party application**.
- **Affected endpoints**:
  - `GET /api/my-account/identities/:target/access-token`
  - `PUT /api/my-account/identities/:target/access-token`
  - Reading backup codes, sessions, grants, trusted devices
- **Result for third-party apps**: They now get `403 auth.third_party_application_forbidden`
- **Note**: First-party apps (like Account Center, Console) are unaffected.
- **Action**: If your integration uses stored tokens, switch to a **first-party app**.

### 3. **Connector Request Errors**
- **Change**: When a connector request fails (e.g., timeout), **sensitive data (headers, body, query strings)** is no longer logged or returned.
- **Only the error name, code, and message** are exposed.
- **What’s kept**: Request method, origin, and pathname (for debugging).
- **Why?** Enhances security by reducing exposure of sensitive data in logs.

### 4. **Single-Use Codes and Tokens**
- **Change**: Authorization codes, device codes, pushed auth requests, and one-time tokens are now **single-use only**.
- **Reused token?** Returns:
  - `invalid_grant` (for authorization code)
  - `invalid_request_uri` (for pushed auth)
  - `one_time_token.token_consumed` (for one-time token)
- **Exception**: Refresh tokens still allow reuse within their window.

### 5. **SAML Applications**
- **Change**: Malformed SAML XML (e.g., unescaped `&`, mismatched tags) now returns `400 application.saml.invalid_saml_request`.
- **Audit log**: Records the format error under `samlRequestError`.
- **Benefit**: Prevents 500 errors for malformed requests (especially when signed auth is not required).

---

## 🛠️ **Improvements & New Features**

### 1. **Connector Branding Before Email Match**
- **New setting**: `Show SSO connector names and logos before email match`
- **Location**: `Console > Sign-in experience > Sign-up and sign-in > Advanced options`
- **Default**: On (current behavior)
- **Off**: Only shows connectors after email domain matches
- **Use case**: Useful for privacy or reducing clutter on public sign-in pages.

### 2. **Social Sign-In Enhancements**
- **Unreachable provider**: Now returns `502 connector.social_provider_unreachable` with network error and connector ID.
- **Declined authorization**: Returns `401 connector.authorization_failed` with provider-specific error (e.g., `access_denied`, `user_cancelled_authorize`).
- **Provider error messages**: Now show the actual error from the provider (not `{}`).

### 3. **OAuth & OIDC Improvements**
- **Space-padded scopes**: Logto now **ignores leading/trailing/repeated spaces** in `scope` values (e.g., `" offline_access"`).
- **Fix**: Prevents `invalid_scope` errors and avoids forced re-authentication.

### 4. **Management API**
- **`customClientMetadata`**: Now rejects unknown keys with `400 guard.invalid_input` (lists the key).
- **Pagination links**: Now preserve **all repeated query parameters** (e.g., `?types=SPA&types=Traditional`) instead of joining them.
- **One-time token count**: `Total-Number` header now counts **only matching tokens** when filtered by `email` or `status`.
- **Manual unlock**: Clears **security verification lockouts >60 minutes**.

### 5. **SAML Applications**
- **Attribute placeholders**: Fixed so mapped attributes (e.g., `o365role`) now return the **actual user value**, not the placeholder `{attr...}`.

### 6. **Console & Account Center**
- **Application access control**: Organization selector now **filters results** when searching.
- **Role permissions**: Full API resource names shown; truncated names have tooltips.
- **Account Center branding**: No longer shows "Powered by Logto" during load when branding is hidden.

### 7. **Documentation**
- **Swift integration guide**: Fixed **client name consistency** to avoid `Cannot find 'client' in scope` in Xcode.

---

## 🔄 **Connectors**

### 1. **Standard OAuth 2.0 & OIDC**
- **String `expires_in`**: Now accepted (e.g., from Criipto).
- **JSON array `scope`**: Now accepted (e.g., from Twitch), normalized to space-delimited string.

### 2. **Patreon**
- **Fix**: Patreon v1 API is deprecated; now uses **v2 identity endpoint**.
- **Result**: Patreon sign-in works again.

### 3. **Connector Kit**
- **Performance**: `jsonGuard` and `jsonObjectGuard` now build schema **once**, not per nested value.
- **Benefit**: Faster validation for large JSON payloads.

---

## 🖥️ **Self-Hosting & OSS Notes**

### 1. **Review Before Upgrading**
- Check:
  - OAuth 2.0 & Azure AD email sync
  - SAML assertion audience
  - Third-party Account API changes

### 2. **Node.js 26**
- **Docker image** now runs on **Node.js 26**.
- **Supported versions**: 22, 24, 26 (minimums: 22.23.4, 24.22.1, 26.12.1)
- **Security**: Includes **October 2026** Node.js security fixes.

### 3. **Database Migration Required**
- **Schema changes**: New columns for SAML static attributes and sign-in/Account Center settings.
- **Action**: Run:
  ```bash
  npm run alteration deploy
  # or
  logto db alteration deploy
  ```
- **Note**: Do this **before starting the new version**.

### 4. **Database Connection Retries**
- **Now**: Retries on DNS failures (`ENOTFOUND`, `EAI_AGAIN`) at startup and CLI commands.
- **Benefit**: More resilient to transient network issues.

### 5. **Admin Endpoint Warning**
- **New log**: Warns once if a `/console` request reaches the default tenant due to **mismatched `ADMIN_ENDPOINT`**.
- **Action**: Check Console URL and `ADMIN_ENDPOINT` environment variable.

---

## 👥 **Contributors**
Huge thanks to:
- **@nicolaj0** – Multiple contributions (webhooks, metadata validation, error handling, DNS retries)
- **@RaphaelFakhri** – First contribution: pagination links
- **@mvanhorn** – `ADMIN_ENDPOINT` warning
- **@timokoethe** – Swift guide consistency

🔗 Full changelog: [v1.45.0...v1.46.0](https://github.com/logto-io/logto/compare/v1.45.0...v1.46.0)

---

## ✅ **Summary of Key Actions for Users**

| Area | Action |
|------|--------|
| **SAML Setup** | Ensure `Audience` matches SP Entity ID in IdP |
| **Third-Party Apps** | Switch to **first-party apps** for Account API access |
| **Database Upgrade** | Run `logto db alteration deploy` after upgrade |
| **Node.js** | Use Node.js 22, 24, or 26 (minimum versions required) |
| **Error Handling** | Expect more precise errors (e.g., `403`, `401`, `400`) instead of generic 500s |
| **Security** | No sensitive data in logs; single-use tokens enforced |

---

## 📌 Final Notes
This release emphasizes **security**, **stability**, and **developer experience**. It’s a significant update for **self-hosted and OSS users**, so **careful planning** is needed for upgrades.

For more details, see the [Logto OSS Upgrade Guide](https://docs.logto.io/logto-oss/upgrading-oss-version).