Docs

Discover how Phala's AI Agent Contract offers the essential tools to develop and profit from intelligent applications.

Explore Now

Developer Guide: Setup Twitter Cookies Authentication for Eliza

Invalid Date

Here’s a step-by-step Twitter (X) Cookies Auth Guide for connecting your X account to an agent like Eliza:


1. Get Cookies Authentication Values

  • Log into your Twitter (X) account.
  • Right-click anywhere on the page and select Inspect to open Chrome DevTools.
  • In DevTools, go to Application > Storage > Cookies > https://x.com.
  • Locate these cookies:
    • auth_token
    • ct0
    • guest_id
  • Double-click the value, right-click, and select Copy for each one.
  • These values map as follows:
    • Cookies Auth Tokenauth_token
    • Cookies CT0ct0
    • Cookies Guest IDguest_id
  • Paste each into their respective fields for the agent configuration.[1]

2. Get Your 2FA Secret

  • In addition to cookies, you need your Twitter/X 2FA (Two-Factor Authentication) secret:
    • Go to Settings and privacySecurity and account accessSecurity.
    • Under Two-factor authentication, click Can’t scan the QR Code?
    • Copy the provided code (the 2FA secret) and paste it where required.
    • If you already have 2FA enabled, you may need to disable and re-enable it to get a new secret.
    • Use your authenticator app to scan the QR code or enter the code manually, then confirm.[1]

3. Configure & Deploy Your Agent

  • Double-check all credentials before starting the agent. All fields are required (cookies and 2FA).
  • Once deployed, check your dashboard to confirm the agent is listed and running. Logs can be viewed in the CVM’s container if needed.

4. Environment Variable Format Example

Inside your config or .env, set the values as follows:

TWITTER_USERNAME=xxxx
TWITTER_PASSWORD=xxxx
TWITTER_EMAIL[email protected]
TWITTER_2FA_SECRET=xxxx
TWITTER_COOKIES_AUTH_TOKEN=xxx
TWITTER_COOKIES_CT0=xxxx
TWITTER_COOKIES_GUEST_ID=xxxx

5. Troubleshooting & Tips

  • If login fails, try logging out on all sessions, acquiring fresh cookies, and double-checking your 2FA secret.
  • Make sure to keep your cookies and 2FA info safe—do not share them publicly.
  • All fields (including cookies and 2FA secret) are mandatory.
  • Additional tips are available in the agent's documentation or this tutorial.

About Phala

Phala Network is a decentralized cloud that offers secure and scalable computing for Web3.

With Phat Contracts, an innovative programming model enabling trustless off-chain computation, developers can create new Web3 use cases.

Get the latest Phala Content Straight To Your Inbox.