Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Twitter cookies do not match the docs #558

Closed
grallc opened this issue Nov 24, 2024 · 1 comment
Closed

Twitter cookies do not match the docs #558

grallc opened this issue Nov 24, 2024 · 1 comment
Labels
bug Something isn't working Client: Twitter documentation Improvements or additions to documentation

Comments

@grallc
Copy link
Contributor

grallc commented Nov 24, 2024

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.

@grallc grallc added the bug Something isn't working label Nov 24, 2024
@madjin madjin added documentation Improvements or additions to documentation Client: Twitter labels Dec 18, 2024
@madjin
Copy link
Collaborator

madjin commented Dec 25, 2024

looks like its fixed, closing

@madjin madjin closed this as completed Dec 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Client: Twitter documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants
@grallc @madjin and others