← back to Dear Bubbe Nextjs

scripts/setup-x-tokens.sh

41 lines

#!/bin/bash

echo "==================================="
echo "🔑 X.COM TOKEN SETUP FOR @DearBubbe"
echo "==================================="
echo ""
echo "To get your tokens:"
echo "1. Open x.com in Chrome"
echo "2. Login to @DearBubbe"
echo "3. Press F12 for DevTools"
echo "4. Go to: Application → Cookies → x.com"
echo "5. Find these cookies:"
echo ""
echo "   auth_token: (long string)"
echo "   ct0: (shorter string)"
echo ""
echo "==================================="
echo ""

read -p "Paste your auth_token here: " AUTH_TOKEN
read -p "Paste your ct0 token here: " CT0_TOKEN

if [ -z "$AUTH_TOKEN" ] || [ -z "$CT0_TOKEN" ]; then
    echo "❌ Both tokens are required!"
    exit 1
fi

# Save tokens
cat > /root/Projects/dear-bubbe-nextjs/lib/x-tokens.json << EOF
{
  "auth_token": "$AUTH_TOKEN",
  "ct0": "$CT0_TOKEN",
  "bearer": "AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA"
}
EOF

echo ""
echo "✅ Tokens saved!"
echo ""
echo "Testing with a sample post..."
node /root/Projects/dear-bubbe-nextjs/lib/x-graphql-poster.js test "Testing Bubbe auto-post system at $(date)"