Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions enterprise-api/getting-started/getting-access.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,14 @@ You'll receive several credentials depending on your authentication needs:

| Credential | Purpose |
|:-----------|:--------|
| **API Key & Secret** | Identify your app. Used to generate tokens and sign OAuth 1.0a requests. |
| **Bearer Token** | App-only authentication for reading public data. |
| **Access Token & Secret** | Make requests on behalf of your own account (OAuth 1.0a). |
| **Client ID & Secret** | OAuth 2.0 authentication for user-context requests. |
| **Client ID & Secret** | OAuth 2.0 authentication for user-context requests (required for newly created apps). |
| **API Key & Secret** | Identify your app and sign OAuth 1.0a requests (existing apps only). |
| **Access Token & Secret** | Make requests on behalf of your own account with OAuth 1.0a (existing apps only). |

<Warning>
**OAuth 1.0a is disabled for newly created apps** and is scheduled to be retired on **January 31, 2027**. Newly created apps must use [OAuth 2.0](/fundamentals/authentication/oauth-2-0/overview) (Bearer Token for public data, or OAuth 2.0 Authorization Code Flow with PKCE for user-context requests). Existing apps with OAuth 1.0a enabled can continue using it until January 31, 2027 — see [Migrate from OAuth 1.0a to OAuth 2.0](/fundamentals/authentication/oauth-2-0/oauth-1-0a-token-exchange).
</Warning>

<Warning>
**Save immediately.** X only displays credentials once. Store them in a password manager or secure vault. If you lose them, regenerate them (which invalidates the old ones).
Expand All @@ -78,18 +82,18 @@ You'll receive several credentials depending on your authentication needs:
Best for: Searching posts, looking up users, reading trends.
</Tab>
<Tab title="Acting as a user">
Use **OAuth 2.0** (recommended) or **OAuth 1.0a** to act on behalf of users.
Use **OAuth 2.0** (Authorization Code Flow with PKCE) to act on behalf of users. Newly created apps must use OAuth 2.0, as OAuth 1.0a is disabled for new apps and retiring on January 31, 2027.

OAuth 2.0 offers fine-grained scopes—request only the permissions you need.

Best for: Posting, liking, following, accessing DMs.

[OAuth 2.0 guide →](/resources/fundamentals/authentication/oauth-2-0/overview)
[OAuth 2.0 guide →](/fundamentals/authentication/oauth-2-0/overview)
</Tab>
<Tab title="Acting as yourself">
Use your **Access Token & Secret** to make requests as your own account.
Authorize your own X account using **OAuth 2.0 Authorization Code Flow with PKCE** (with `offline.access` for refresh tokens) to make requests as your own account.

These tokens represent the account that owns the app.
Existing apps with OAuth 1.0a enabled can continue using their **Access Token & Secret** until January 31, 2027.

Best for: Testing, personal bots, your own automation.
</Tab>
Expand Down
4 changes: 4 additions & 0 deletions fundamentals/authentication/api-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ keywords: ["OAuth API reference", "authentication API", "OAuth endpoints", "auth

### OAuth 1.0a

<Warning>
**OAuth 1.0a is disabled for newly created apps** and is scheduled to be retired on **January 31, 2027**. Newly created apps must use [OAuth 2.0](/fundamentals/authentication/oauth-2-0/overview). Existing apps with OAuth 1.0a enabled can continue using these endpoints until January 31, 2027 — see [Migrate from OAuth 1.0a to OAuth 2.0](/fundamentals/authentication/oauth-2-0/oauth-1-0a-token-exchange) to move existing users without requiring re-authorization.
</Warning>

| | |
| :--- | :--- |
| **Purpose** | Method |
Expand Down
3 changes: 3 additions & 0 deletions fundamentals/authentication/faq.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ description: Answers to common questions about OAuth 1.0a, OAuth 2.0, access tok

## General
<AccordionGroup>
<Accordion title="Can I use OAuth 1.0a with a newly created app?">
No. As part of the planned retirement of OAuth 1.0a on **January 31, 2027**, OAuth 1.0a is disabled for newly created apps. Newly created apps must use [OAuth 2.0](/fundamentals/authentication/oauth-2-0/overview) (Authorization Code Flow with PKCE for user context, or Bearer Token for app-only requests). Existing apps with OAuth 1.0a already enabled can continue using it until January 31, 2027 — see [Migrate from OAuth 1.0a to OAuth 2.0](/fundamentals/authentication/oauth-2-0/oauth-1-0a-token-exchange) to migrate stored user tokens without requiring re-authorization.
</Accordion>
<Accordion title="What is OAuth?">
OAuth is an authentication protocol that allows users to approve an application to act on their behalf without sharing their password. More information can be found at [oauth.net](http://oauth.net/).
</Accordion>
Expand Down
4 changes: 4 additions & 0 deletions fundamentals/authentication/guides/log-in-with-x.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ keywords: ["Log in with X", "Sign in with X", "X login", "OAuth login", "social

import { Button } from "/snippets/button.mdx";

<Warning>
**OAuth 1.0a is disabled for newly created apps** and is scheduled to be retired on **January 31, 2027**. The OAuth 1.0a Log in with X flow on this page is only available for existing apps that already have OAuth 1.0a enabled. Newly created apps must use [OAuth 2.0 Authorization Code Flow with PKCE](/fundamentals/authentication/oauth-2-0/authorization-code). To move existing OAuth 1.0a users to OAuth 2.0 without requiring re-authorization, see [Migrate from OAuth 1.0a to OAuth 2.0](/fundamentals/authentication/oauth-2-0/oauth-1-0a-token-exchange).
</Warning>

Use Log in with X, also known as Sign in with X, to place a button on your site or application which allows X users to enjoy the benefits of a registered user account in as little as one click. This works on websites, iOS, mobile, and desktop applications.

## Features
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ description: "The following chart illustrates which v2 endpoints map to what aut

import { Button } from "/snippets/button.mdx";

The following chart illustrates which v2 endpoints map to what authentication methods. 

The following chart illustrates which v2 endpoints map to what authentication methods.

<Warning>
**OAuth 1.0a is disabled for newly created apps** and is scheduled to be retired on **January 31, 2027**. Newly created apps must use **OAuth 2.0** (App Only Bearer Token or Authorization Code with PKCE). Existing apps with OAuth 1.0a enabled can continue using it until January 31, 2027 — see [Migrate from OAuth 1.0a to OAuth 2.0](/fundamentals/authentication/oauth-2-0/oauth-1-0a-token-exchange).
</Warning>

| | | | |
| :--- | :--- | :--- | :--- |
Expand Down
4 changes: 4 additions & 0 deletions fundamentals/authentication/oauth-1-0a/api-key-and-secret.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ import { Button } from "/snippets/button.mdx";

### API Key and Secret

<Warning>
**OAuth 1.0a is disabled for newly created apps** and is scheduled to be retired on **January 31, 2027**. Newly created apps must use [OAuth 2.0](/fundamentals/authentication/oauth-2-0/overview) (Authorization Code Flow with PKCE for user context, or Bearer Token for app-only requests). Existing apps with OAuth 1.0a enabled can continue using it until January 31, 2027 — see [Migrate from OAuth 1.0a to OAuth 2.0](/fundamentals/authentication/oauth-2-0/oauth-1-0a-token-exchange) to move existing users without requiring re-authorization.
</Warning>

The API Key and Secret (also known as Consumer Key and Secret) are the most fundamental credentials required to access the X API. These credentials act as the username and password for your X App, and are used by the X API to understand which App requests are coming from. 

These credentials can be used by [authentication endpoints](/resources/fundamentals/authentication/api-reference) to generate additional credentials, such as [user Access Tokens and Secrets](/resources/fundamentals/authentication/oauth-1-0a/api-key-and-secret), and [Bearer Tokens](/resources/fundamentals/authentication/oauth-2-0/bearer-tokens). You also need to use these credentials along with Access Tokens and other authorization parameters to [authorize requests](/resources/fundamentals/authentication/oauth-1-0a/authorizing-a-request) that require OAuth 1.0a User Context authentication. 
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ import { Button } from "/snippets/button.mdx";

### Authorizing a request

<Warning>
**OAuth 1.0a is disabled for newly created apps** and is scheduled to be retired on **January 31, 2027**. Newly created apps must use [OAuth 2.0](/fundamentals/authentication/oauth-2-0/overview) (Authorization Code Flow with PKCE for user context, or Bearer Token for app-only requests). Existing apps with OAuth 1.0a enabled can continue using it until January 31, 2027 — see [Migrate from OAuth 1.0a to OAuth 2.0](/fundamentals/authentication/oauth-2-0/oauth-1-0a-token-exchange) to move existing users without requiring re-authorization.
</Warning>

The purpose of this document is to show you how to modify HTTP requests for the purpose of sending authorized requests to the X API.

All of X's APIs are based on the HTTP protocol. This means that any software you write which uses X's APIs sends a series of structured messages to X’s servers. For example, a request to post the text “**Hello Ladies + Gentlemen, a signed OAuth request!**” as a Tweet will look something like this:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ import { Button } from "/snippets/button.mdx";

### Creating a signature

<Warning>
**OAuth 1.0a is disabled for newly created apps** and is scheduled to be retired on **January 31, 2027**. Newly created apps must use [OAuth 2.0](/fundamentals/authentication/oauth-2-0/overview) (which sends a `Bearer` token instead of HMAC-SHA1 signatures). Existing apps with OAuth 1.0a enabled can continue using it until January 31, 2027 — see [Migrate from OAuth 1.0a to OAuth 2.0](/fundamentals/authentication/oauth-2-0/oauth-1-0a-token-exchange) to move existing users without requiring re-authorization.
</Warning>

This page explains how to generate an OAuth 1.0a HMAC-SHA1 signature for an HTTP request. This signature will be suitable for passing to the X API as part of an authorized request, as described in [authorizing a request.](/resources/fundamentals/authentication/oauth-1-0a/authorizing-a-request)

The request used to demonstrate signing is a POST to https://api.x.com/1.1/statuses/update.json. The raw request looks like this:
Expand Down
4 changes: 4 additions & 0 deletions fundamentals/authentication/oauth-1-0a/oauth-echo.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ import { Button } from "/snippets/button.mdx";

### OAuth Echo

<Warning>
**OAuth 1.0a is disabled for newly created apps** and is scheduled to be retired on **January 31, 2027**. Newly created apps must use [OAuth 2.0](/fundamentals/authentication/oauth-2-0/overview). Existing apps with OAuth 1.0a enabled can continue using it until January 31, 2027 — see [Migrate from OAuth 1.0a to OAuth 2.0](/fundamentals/authentication/oauth-2-0/oauth-1-0a-token-exchange) to move existing users without requiring re-authorization.
</Warning>

OAuth Echo is a means to securely delegate OAuth authorization with a third party while interacting with an API.

There are four parties involved in this interaction:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ import { Button } from "/snippets/button.mdx";

### Obtaining access tokens using 3-legged OAuth flow

<Warning>
**OAuth 1.0a is disabled for newly created apps** and is scheduled to be retired on **January 31, 2027**. Newly created apps must use [OAuth 2.0 Authorization Code Flow with PKCE](/fundamentals/authentication/oauth-2-0/authorization-code) to obtain user access tokens. Existing apps with OAuth 1.0a enabled can continue using it until January 31, 2027 — see [Migrate from OAuth 1.0a to OAuth 2.0](/fundamentals/authentication/oauth-2-0/oauth-1-0a-token-exchange) to move existing users without requiring re-authorization.
</Warning>

To perform actions on behalf of another user, you'll need to obtain their access tokens. Access tokens specify the X account the request is made on behalf of, so for you to obtain these they will need to first grant you access. These tokens do not expire but can be revoked by the user at any time.

X allows you to obtain user access tokens through the 3-legged OAuth flow, which allows your application to obtain an **access token** and access token secret by redirecting a user to X and having them authorize your application. This flow is almost identical to the flow described in [implementing Log in with X](/resources/fundamentals/authentication/guides/log-in-with-x), with two exceptions:
Expand Down
6 changes: 3 additions & 3 deletions fundamentals/authentication/oauth-1-0a/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import { Button } from "/snippets/button.mdx";

## OAuth 1.0a

<Tip>
Already have users who authorized your app with OAuth 1.0a? You can convert their stored access tokens to OAuth 2.0 tokens without asking them to re-authorize. See [Migrating OAuth 1.0a user tokens to OAuth 2.0](/fundamentals/authentication/oauth-2-0/oauth-1-0a-token-exchange).
</Tip>
<Warning>
**OAuth 1.0a is disabled for newly created apps** and is scheduled to be retired on **January 31, 2027**. Newly created apps must use [OAuth 2.0](/fundamentals/authentication/oauth-2-0/overview) (Authorization Code Flow with PKCE for user context, or Bearer Token for app-only requests). Existing apps with OAuth 1.0a enabled can continue using it until January 31, 2027 — see [Migrate from OAuth 1.0a to OAuth 2.0](/fundamentals/authentication/oauth-2-0/oauth-1-0a-token-exchange) to convert stored user access tokens without requiring users to re-authorize.
</Warning>

Many endpoints on the X developer platform use the OAuth 1.0a method to act, or make API requests, on behalf of a X account. For example, if you have a X developer app, you can make API requests on behalf of any X account as long as that user authenticates your app.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ import { Button } from "/snippets/button.mdx";

### Percent encoding parameters

<Warning>
**OAuth 1.0a is disabled for newly created apps** and is scheduled to be retired on **January 31, 2027**. Newly created apps must use [OAuth 2.0](/fundamentals/authentication/oauth-2-0/overview), which does not require OAuth 1.0a request signing. Existing apps with OAuth 1.0a enabled can continue using it until January 31, 2027 — see [Migrate from OAuth 1.0a to OAuth 2.0](/fundamentals/authentication/oauth-2-0/oauth-1-0a-token-exchange) to move existing users without requiring re-authorization.
</Warning>

Parts of the X API, particularly those dealing with OAuth signatures, require strings to be encoded according to [RFC 3986, Section 2.1](http://tools.ietf.org/html/rfc3986#section-2.1). Since many implementations of URL encoding algorithms are not fully compatible with RFC 3986, bad encodings are a cause of many OAuth signature errors. For this reason, the exact signing algorithm to use is covered on this page.

This page covers the URL encoding process described in [RFC 3986, Section 2.1](http://tools.ietf.org/html/rfc3986#section-2.1). We encourage you to reference that specification in case of any ambiguity or conflict with this document.
Expand Down
4 changes: 4 additions & 0 deletions fundamentals/authentication/oauth-1-0a/pin-based-oauth.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ import { Button } from "/snippets/button.mdx";

### PIN-based authorization

<Warning>
**OAuth 1.0a is disabled for newly created apps** and is scheduled to be retired on **January 31, 2027**. Newly created apps must use [OAuth 2.0 Authorization Code Flow with PKCE](/fundamentals/authentication/oauth-2-0/authorization-code). Existing apps with OAuth 1.0a enabled can continue using it until January 31, 2027 — see [Migrate from OAuth 1.0a to OAuth 2.0](/fundamentals/authentication/oauth-2-0/oauth-1-0a-token-exchange) to move existing users without requiring re-authorization.
</Warning>

The PIN-based OAuth flow is a version of the [3-legged OAuth](/resources/fundamentals/authentication/oauth-1-0a/obtaining-user-access-tokens) process and is intended for applications that cannot access or embed a web browser to redirect the user after authorization. Examples of such applications would be command-line applications, embedded systems, game consoles, and certain types of mobile apps.

PIN-based OAuth flow is initiated by an app in the `request_token` with the `oauth_callback` set to `oob`. The term `oob` means out-of-band OAuth.  The user still visits X to login or authorize the app, but they will not be automatically redirected to the application upon approving access. Instead, they will see a numerical PIN code, with instructions to return to the application and enter this value.
Expand Down
4 changes: 2 additions & 2 deletions fundamentals/authentication/oauth-2-0/authorization-code.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ POST 'https://api.x.com/2/oauth2/token' \

#### App settings

You can select your App’s authentication settings to be OAuth 1.0a or OAuth 2.0. You can also enable an App to access both OAuth 1.0a and OAuth 2.0.
Newly created apps use **OAuth 2.0** only — OAuth 1.0a is disabled for newly created apps and is scheduled to be retired on **January 31, 2027**. Existing apps that already have OAuth 1.0a enabled can also enable OAuth 2.0 to run both side by side while migrating (see [Migrate from OAuth 1.0a to OAuth 2.0](/fundamentals/authentication/oauth-2-0/oauth-1-0a-token-exchange)).

OAuth 2.0 can be used with the X API v2 only. If you have selected OAuth 2.0 you will be able to see a Client ID in your App’s Keys and Tokens section. 
OAuth 2.0 can be used with the X API v2 and the Ads API. Once OAuth 2.0 is configured, you will see a Client ID in your App’s Keys and Tokens section.

#### Confidential clients

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: "Move your app and your existing users from OAuth 1.0a to OAuth 2.0
keywords: ["OAuth 1.0a to OAuth 2.0", "OAuth 1.0a migration", "OAuth 1.0a deprecation", "OAuth 1.0a retirement", "token exchange", "migrate OAuth 1.0a", "OAuth 2.0 migration", "token-exchange grant", "oauth1_token", "refresh token", "Bearer token", "AI coding agent"]
---

X is retiring OAuth 1.0a user authentication. Apps have until **January 31, 2027**, to move to OAuth 2.0. After that date, requests signed with OAuth 1.0a stop working.
X is retiring OAuth 1.0a user authentication. **OAuth 1.0a is already disabled for newly created apps**, which must use [OAuth 2.0](/fundamentals/authentication/oauth-2-0/overview) from the start. Existing apps with OAuth 1.0a enabled have until **January 31, 2027**, to move to OAuth 2.0. After that date, requests signed with OAuth 1.0a stop working.

**Why:** OAuth 2.0 is more secure for your users. OAuth 1.0a user tokens never expire, so a leaked token keeps working until the user revokes your app. OAuth 2.0 access tokens expire after 2 hours, refresh tokens are single-use, and each token carries only the scopes the user granted.

Expand Down Expand Up @@ -521,7 +521,7 @@ Run `migrate_users(store)` (`migrateUsers` in TypeScript) as a batch job. Before

<AccordionGroup>
<Accordion title="When does OAuth 1.0a stop working?">
On **January 31, 2027**. Until then, OAuth 1.0a and OAuth 2.0 both work, so you can migrate at your own pace. After that date, requests signed with OAuth 1.0a fail and the token exchange is no longer available.
OAuth 1.0a is already disabled for newly created apps — new apps must use OAuth 2.0. For existing apps with OAuth 1.0a enabled, OAuth 1.0a stops working on **January 31, 2027**. Until then, OAuth 1.0a and OAuth 2.0 both work on existing apps, so you can migrate at your own pace. After that date, requests signed with OAuth 1.0a fail and the token exchange is no longer available.
</Accordion>
<Accordion title="Do my users need to re-authorize my app?">
No. The exchange moves each user to OAuth 2.0 with no consent screen, no notification, and no session change. Their existing connection to your app continues. A user only has to sign in again if their OAuth 1.0a token is rejected with `invalid_grant`, if you need scopes their original authorization didn't cover, or if you haven't migrated them by the retirement date.
Expand Down
Loading
Loading