{"connections":[{"id":"twitter-api-v2","title":"twitter-api-v2 (TypeScript)","kind":"sdk","language":"typescript","description":"Point the twitter-api-v2 SDK at the emulator for both app-only and user-context auth.","template":"import { TwitterApi } from \"twitter-api-v2\";\n\nconst base = \"{{baseUrl}}\";\n\n// App-only Bearer token (client_credentials).\nconst appClient = new TwitterApi(\"{{token}}\", { baseUrl: base });\nconst user = await appClient.v2.userByUsername(\"developer\");\n\n// OAuth 2.0 user-context client (Authorization Code with PKCE).\nconst oauthClient = new TwitterApi({ clientId: \"{{clientId}}\", clientSecret: \"{{clientSecret}}\" });\nconst { url, codeVerifier, state } = oauthClient.generateOAuth2AuthLink(\n  \"http://localhost:3000/api/auth/callback/twitter\",\n  { scope: [\"tweet.read\", \"tweet.write\", \"users.read\", \"offline.access\"] },\n);\n// Send the user to `url` (against `${base}/2/oauth2/authorize`), then exchange the code at `${base}/2/oauth2/token`.","body":"import { TwitterApi } from \"twitter-api-v2\";\n\nconst base = \"https://x.your-instance.emulators.dev\";\n\n// App-only Bearer token (client_credentials).\nconst appClient = new TwitterApi(\"<token>\", { baseUrl: base });\nconst user = await appClient.v2.userByUsername(\"developer\");\n\n// OAuth 2.0 user-context client (Authorization Code with PKCE).\nconst oauthClient = new TwitterApi({ clientId: \"<client_id>\", clientSecret: \"<client_secret>\" });\nconst { url, codeVerifier, state } = oauthClient.generateOAuth2AuthLink(\n  \"http://localhost:3000/api/auth/callback/twitter\",\n  { scope: [\"tweet.read\", \"tweet.write\", \"users.read\", \"offline.access\"] },\n);\n// Send the user to `url` (against `${base}/2/oauth2/authorize`), then exchange the code at `${base}/2/oauth2/token`."},{"id":"x-env","title":"X base URL and credentials (env)","kind":"env","language":"bash","description":"Point your app at the emulator instead of api.x.com.","template":"X_API_BASE_URL={{baseUrl}}\nX_CLIENT_ID={{clientId}}\nX_CLIENT_SECRET={{clientSecret}}\nX_BEARER_TOKEN={{token}}","body":"X_API_BASE_URL=https://x.your-instance.emulators.dev\nX_CLIENT_ID=<client_id>\nX_CLIENT_SECRET=<client_secret>\nX_BEARER_TOKEN=<token>"},{"id":"curl-app-only","title":"curl (app-only Bearer)","kind":"curl","language":"bash","description":"Mint an app-only Bearer token (confidential client, HTTP Basic auth) and read a user.","template":"curl -s -X POST {{baseUrl}}/2/oauth2/token \\\n  -u \"{{clientId}}:{{clientSecret}}\" \\\n  -d grant_type=client_credentials\n\ncurl -s {{baseUrl}}/2/users/by/username/developer \\\n  -H \"authorization: Bearer {{token}}\"","body":"curl -s -X POST https://x.your-instance.emulators.dev/2/oauth2/token \\\n  -u \"<client_id>:<client_secret>\" \\\n  -d grant_type=client_credentials\n\ncurl -s https://x.your-instance.emulators.dev/2/users/by/username/developer \\\n  -H \"authorization: Bearer <token>\""},{"id":"curl-token-exchange","title":"curl (authorization code + PKCE)","kind":"curl","language":"bash","description":"Exchange an authorization code for a user-context token. Confidential clients use -u (Basic); public clients send client_id in the body with no secret.","template":"curl -s -X POST {{baseUrl}}/2/oauth2/token \\\n  -u \"{{clientId}}:{{clientSecret}}\" \\\n  -d grant_type=authorization_code \\\n  -d code=$CODE \\\n  -d redirect_uri=http://localhost:3000/api/auth/callback/twitter \\\n  -d code_verifier=$CODE_VERIFIER","body":"curl -s -X POST https://x.your-instance.emulators.dev/2/oauth2/token \\\n  -u \"<client_id>:<client_secret>\" \\\n  -d grant_type=authorization_code \\\n  -d code=$CODE \\\n  -d redirect_uri=http://localhost:3000/api/auth/callback/twitter \\\n  -d code_verifier=$CODE_VERIFIER"},{"id":"base-url","title":"Base URL (env)","kind":"env","language":"bash","description":"Point your SDK or app at the emulator instead of the real provider.","template":"{{SERVICE_UPPER}}_BASE_URL={{baseUrl}}","body":"X_BASE_URL=https://x.your-instance.emulators.dev"},{"id":"create-credential","title":"Create a credential","kind":"curl","language":"bash","description":"Mint a working credential for this instance.","template":"curl -s -X POST {{controlBaseUrl}}/credentials \\\n  -H \"content-type: application/json\" \\\n  -d '{\"type\":\"{{defaultAuthType}}\"}'","body":"curl -s -X POST https://x.your-instance.emulators.dev/_emulate/credentials \\\n  -H \"content-type: application/json\" \\\n  -d '{\"type\":\"bearer-token\"}'"},{"id":"inspect-ledger","title":"Inspect requests","kind":"curl","language":"bash","description":"Read the request ledger to validate how your app called the service.","template":"curl -s {{controlBaseUrl}}/ledger","body":"curl -s https://x.your-instance.emulators.dev/_emulate/ledger"}]}