Closed
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