Skip to content

Twitter cookies do not match the docs #558

Closed
@grallc

Description

Describe the bug
After trying to setup my twitter client using cookies following this format, I was quite surprised that I was always facing auth related errors even though the details were correct.
After deeping more, I found out that it was trying to set cookies using a different format.

https://github.com/ai16z/eliza/blob/main/packages/client-twitter/src/base.ts#L548

async setCookiesFromArray(cookiesArray: any[]) {
        const cookieStrings = cookiesArray.map(
            (cookie) =>
                `${cookie.key}=${cookie.value}; Domain=${cookie.domain}; Path=${cookie.path}; ${
                    cookie.secure ? "Secure" : ""
                }; ${cookie.httpOnly ? "HttpOnly" : ""}; SameSite=${
                    cookie.sameSite || "Lax"
                }`
        );
        await this.twitterClient.setCookies(cookieStrings);
    }

using cookie.key in the map, while it's the example uses name as the key in the docs:
https://github.com/ai16z/eliza/blob/main/packages/client-twitter/src/base.ts#L548

TWITTER_COOKIES='[{"name":"auth_token","value":"your token","domain":".twitter.com"},
  {"name":"ct0","value":"your ct0","domain":".twitter.com"},
  {"name":"guest_id","value":"your guest_id","domain":".twitter.com"}]'

To Reproduce
Just need to try creating a twitter client following the documentation.

Opening a PR to change that.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Client: TwitterbugSomething isn't workingdocumentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions