## Twitter integration Integrating Twitter with Frontegg allows your application to read tweets, post on behalf of users, and access direct messages — all through Frontegg's integration layer using X's OAuth 2.0. Prerequisites - A Twitter or X account - Access to the [X Developer Console](https://console.x.com/) ### Create a Twitter OAuth app #### Step 1: Open the X Developer Console Go to [console.x.com](https://console.x.com/) and sign in with your X (Twitter) account. After signing in, you land on the developer dashboard. ![X Developer Console dashboard](/assets/twitter-1.639b6bf51d347b8f760eba5ebcfabc80144ce92d26cdacecf01ba76429d7ed0a.1ce25488.png) #### Step 2: Open the Apps page In the left sidebar, click **Apps**. On the Apps page, click **Create App**. ![Apps page with Create App button highlighted](/assets/twitter-2.026f70f17a8b37a4e3abc1ea230cc7ab09eb7c1d32d585029efb6d851f18d4cf.1ce25488.png) #### Step 3: Name your app In the **Create New Client Application** dialog: 1. Enter a name for the app — for example, `Frontegg Integration`. 2. Leave **Environment** as **Development**. 3. Click **Create New Client Application**. ![Create New Client Application dialog with name filled in](/assets/twitter-3.b68ffe08510dc4c47c22eeac0860e6a255ca1a11933959112d481dfc672b3577.1ce25488.png) #### Step 4: Save or close the initial credentials dialog After the app is created, a dialog displays a **Consumer Key**, **Secret Key**, and **Bearer Token**. These are OAuth 1.0a credentials — save them if you intend to use OAuth 1.0a access. For the Frontegg integration, you will use OAuth 2.0 credentials that are generated in a later step. Click **Close** to dismiss the dialog. Save your credentials The Secret Key and Bearer Token are shown only once. If you need OAuth 1.0a access, copy and save them before closing this dialog. ![Application Created Successfully dialog showing Consumer Key and blurred secrets](/assets/twitter-4.3050e323c9cf2c245fd2dfe5651439b2ca53ee40fddca6eaea050ceaac7b8d33.1ce25488.png) #### Step 5: Set up user authentication After closing the dialog, click on **Frontegg Integration** in the app list on the left. The app panel opens on the right. Under **User authentication settings**, click **Set up**. ![App panel showing User authentication settings section with Set up button highlighted](/assets/twitter-5.0ebf5dee210f759681a0862ca6d0bd8f422e3082b9eac9be5a1eac953219c740.1ce25488.png) #### Step 6: Configure permissions and app type On the **Authentication settings** page: 1. Under **App permissions**, select **Read and write and Direct message**. 2. Under **Type of App**, select **Web App, Automated App or Bot** (Confidential client). ![Authentication settings page showing permissions and app type selections](/assets/twitter-9.0e862231b656caf6c7d27d6ecba4dc193d2d0db8f16a960e6fd0e5551df6b946.1ce25488.png) #### Step 7: Add redirect URIs and save Under **App info**, configure the following fields: 1. In the **Callback URI / Redirect URL** field, enter: ``` https://YOUR_MCP_GATEWAY_URL/integration-callback ``` 2. Click **Add another** and enter: ``` ``` 3. In the **Website URL** field, enter your application's URL. 4. Click **Save Changes**. ![App info section with the redirect URI filled in and Save Changes button](/assets/twitter-7.c1b7c55a32b3cda6cf09ebf231e20b694c0afc5bc6cd9e0c03b94a28d77ecf89.1ce25488.png) #### Step 8: Copy your OAuth 2.0 credentials After saving, a dialog displays your **OAuth 2.0 Client ID** and **Client Secret**. Copy both values and store them securely. Save your Client Secret now The Client Secret is shown only once in this dialog. After you close it, you can only regenerate a new one — the original value cannot be retrieved. ![Did you save your OAuth 2.0 Client Secret dialog showing Client ID and blurred Client Secret](/assets/twitter-8.6e763088ad4bc9e400a646e143b8d98673a8c58066df1bc2c7351fba45ea8d8d.1ce25488.png) You can view the **Client ID** at any time by clicking on the app name in the **Apps** list and scrolling to the **OAuth 2.0 Keys** section. ![App panel showing OAuth 2.0 Keys section with Client ID visible](/assets/twitter-6.952209c08b1a185b08bf38478a710d5ae653cf8b0f657248a1a073bc40a063c0.1ce25488.png) ### Configure the Frontegg portal Once you have your **Client ID** and **Client Secret**, enter them in the Frontegg portal: 1. Open the **Frontegg portal** and navigate to [ENVIRONMENT] → Integrations → Twitter. 2. Enter the **Client ID** and **Client Secret** in the corresponding fields. 3. Select the required **scopes**: | Scope | Description | | --- | --- | | `tweet.read` | Read tweets | | `tweet.write` | Post tweets | | `users.read` | Read user data | | `offline.access` | Stay connected to account | | `dm.read` | Read direct messages | | `dm.write` | Send direct messages | 1. Click **Save**. Keep your credentials secure Never share or commit your Client Secret to version control. ### Additional resources - [X API documentation](https://docs.x.com/x-api) - [X Developer Console](https://console.x.com/) - [OAuth 2.0 with PKCE](https://docs.x.com/resources/fundamentals/authentication/oauth-2-0/authorization-code) - [How to get your Redirect URL](/agen-for-work/connectors/redirect-url)