diff --git a/changelog.mdx b/changelog.mdx index 364e435b0..9ea061518 100644 --- a/changelog.mdx +++ b/changelog.mdx @@ -7,6 +7,18 @@ keywords: ["changelog", "API updates", "release notes", "what's new", "API chang To subscribe to updates, please [**“Turn on notifications”**](https://help.x.com/en/managing-your-account/notifications-on-mobile-devices#:~:text=In%20the%20top%20menu,%20you,you%20would%20like%20to%20receive) for [**@API**](https://x.com/api). You can also follow this changelog in your feed reader via the [**RSS feed**](https://docs.x.com/changelog/rss.xml). + + ### Zero-downtime OAuth 2.0 credential rotation + + The [Developer Console](https://console.x.com) now supports grace-period credential rotation for long-lived OAuth 2.0 credentials so you can roll out replacement credentials across your services without downtime: + + - **Supported credentials:** OAuth 2.0 App-only Bearer Tokens, OAuth 2.0 Client Secrets (including webhook CRC validation during the grace window), and OAuth 2.0 Bot Tokens. + - **Grace windows:** Choose **In 1 hour**, **In 24 hours**, **In 3 days**, or **In 7 days** to keep the previous credential active alongside the new one while you update your deployments, or choose **Now** to revoke immediately. + - **Early expiration:** Use **Expire now** to revoke a retiring credential as soon as your rollout is complete. At most one grace-period rotation can be active per credential at a time. + + See [Rotating OAuth 2.0 credentials with a grace period](/fundamentals/security#rotating-oauth-20-credentials-with-a-grace-period). + + ### X Activity API: real-time trend events (`trends.new`) diff --git a/fundamentals/developer-apps.mdx b/fundamentals/developer-apps.mdx index 8584b40f9..086190725 100644 --- a/fundamentals/developer-apps.mdx +++ b/fundamentals/developer-apps.mdx @@ -122,8 +122,8 @@ These protocols cannot be used: `javascript`, `data`, `file`, `ftp`, `mailto`, ` Create different apps for development, staging, and production. - - Regenerate keys periodically and if you suspect a compromise. + + Rotate OAuth 2.0 credentials with zero downtime using a grace period, or revoke immediately if compromised. Request only the permissions your app actually needs. diff --git a/fundamentals/security.mdx b/fundamentals/security.mdx index f0000e1d4..29da7ff0b 100644 --- a/fundamentals/security.mdx +++ b/fundamentals/security.mdx @@ -39,17 +39,42 @@ Your API keys and tokens are the keys to your app. Keep them secure: Add credential files to `.gitignore`. Use tools like `git-secrets` to prevent accidental commits. - Regenerate keys periodically and immediately if you suspect a compromise. + Rotate credentials periodically and immediately if you suspect a compromise. OAuth 2.0 credentials support [zero-downtime rotation with a grace period](#rotating-oauth-20-credentials-with-a-grace-period) in the Developer Console. Only request the OAuth scopes your app actually needs. +### Rotating OAuth 2.0 credentials with a grace period + +You can rotate long-lived OAuth 2.0 credentials in the [Developer Console](https://console.x.com) without downtime by keeping the previous credential valid during a bounded grace window while you deploy the replacement across your services: + +| Credential | Supported in Developer Console | +|:-----------|:-------------------------------| +| **App-only Bearer Token** | Rotate with a grace period and expire early | +| **OAuth 2.0 Client Secret** | Rotate with a grace period (also accepted for webhook CRC validation during the grace window) and expire early | +| **OAuth 2.0 Bot Token** | Rotate with a grace period and expire early | + +When you click **Rotate** for one of these credentials, choose when the previous credential should expire: + +- **Now** — immediately revokes the previous credential (recommended if a credential is compromised) +- **In 1 hour**, **In 24 hours**, **In 3 days**, or **In 7 days** — issues a new credential immediately while keeping the previous credential active until the selected time + +While a grace window is active: + +- Both the new credential and the retiring credential authenticate requests until the grace window ends. +- Click **Expire now** in the Developer Console at any time to revoke the retiring credential early once your rollout completes. +- At most one grace-period rotation can be active per credential at a time. To start another grace-period rotation, expire the retiring credential first. Choosing **Now** always revokes both the active and retiring credentials immediately for emergencies. + + +Grace-period rotation applies to OAuth 2.0 App-only Bearer Tokens, OAuth 2.0 Client Secrets, and OAuth 2.0 Bot Tokens. OAuth 1.0a keys and tokens and short-lived OAuth 2.0 user access tokens are unchanged. + + ### If credentials are compromised -1. **Regenerate immediately** in the [Developer Console](https://console.x.com) -2. **Revoke old tokens** — regenerating automatically invalidates old credentials +1. **Rotate immediately** in the [Developer Console](https://console.x.com) using the **Now** expiration option +2. **Revoke old tokens** — rotating with **Now** immediately invalidates both the current and any retiring credentials 3. **Audit usage** — check for unauthorized API activity 4. **Update your app** — deploy new credentials to all environments