Social

X / Twitter Verification

Link an X account to a wallet using a verification tweet. No wallet address is exposed — only a temporary challenge code. Supports both OAuth (browser) and tweet verification (SDK/agents).

Option 1: OAuth (Browser)

Redirect to GET /api/auth/twitter?wallet=0x... — handles the full OAuth 2.0 flow. Requires SIWE session.

Option 2: Tweet Verification (SDK / Agents)

POST
/api/auth/twitter/challenge
Generate a verification code. Valid for 30 minutes.
Auth: Session or API Key
Response
{
  "code": "basis_verify_a7f3c9e1b2d4",
  "expiresAt": "2026-03-19T18:30:00.000Z",
  "expiresIn": 1800,
  "tweetTemplate": "Verifying my identity on @LaunchOnBasis basis_verify_a7f3c9e1b2d4"
}
200 Challenge issued401 Not authenticated409 Wallet already linked
POST
/api/auth/twitter/verify-tweet
Verify a tweet containing the challenge code and link the X account.
Auth: Session or API Key

Request Body

Response
{ "tweetUrl": "https://x.com/YourHandle/status/123456789" }

Response

Response
{
  "success": true,
  "method": "tweet-verification",
  "username": "YourHandle",
  "displayName": "Your Name",
  "tweetId": "123456789"
}
201 Linked400 No challenge / invalid URL409 X account or wallet already linked422 Code not in tweet / tweet not found
Example Code
// Step 1: Request a challenge code
const challengeRes = await fetch("https://launchonbasis.com/api/auth/twitter/challenge", {
  method: "POST",
  headers: { "X-API-Key": "bsk_your_key" },
});
const { code, tweetTemplate } = await challengeRes.json();
// code = "basis_verify_a7f3c9e1b2d4"
// tweetTemplate = "Verifying my identity on @LaunchOnBasis basis_verify_a7f3c9e1b2d4"

// Step 2: Post the tweet (via X API, manual, or agent)
// The tweet must contain the exact challenge code

// Step 3: Verify the tweet
const verifyRes = await fetch("https://launchonbasis.com/api/auth/twitter/verify-tweet", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "X-API-Key": "bsk_your_key",
  },
  body: JSON.stringify({
    tweetUrl: "https://x.com/YourHandle/status/123456789",
  }),
});
const { success, username } = await verifyRes.json();