Alfex4936 / Bard-rs

Google Gemini CLI with Rust (Previsouly Bard)
MIT License
83 stars 17 forks source link

Cookie issue #9

Closed davidcortesortuno closed 11 months ago

davidcortesortuno commented 1 year ago

Hi, I built the code successfully and copied the token from the cookies using Firefox but I get

thread 'main' panicked at 'SNlM0e not found', /home/xxxx/.cargo/registry/src/github.com-1ecc6299db9ec823/bard-rs-1.2.2/src/main.rs:134:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Is this related to https://github.com/dsdanielpark/Bard-API/issues/99 ?

Greatz08 commented 1 year ago

same issue i am facing @davidcortesortuno did you got any solution buddy? plus @Alfex4936 buddy can u guide for this :-)

davidcortesortuno commented 1 year ago

No solution, I'm currently using the web interface only

tedsamu commented 1 year ago

I'm getting the same error after a short period of usage. After login out from bard (in browser) and deleting cookie __Secure-1PSID it would work again for short while.

After reading the linked thread, it seems like the Secure-1PSIDTS might be needed (at least for some), So I played around a bit with the Secure-1PSIDTS cookie. And it seems like it is changed after a while and after that the 'SNlM0e not found' error occurs. Updating the cookie to latest value (from browser) makes it work again.

I have not figured out how to automagically get the updated value of __Secure-1PSIDTS. That would probably solve our problems (?).

If you wanna try it out, just find the value of Secure-1PSIDTS in the same way you found Secure-1PSID. Then add it to the session key as a comma separated list. When you get a 'SNlM0e not found' error, update only the __Secure-1PSIDTS and it should work again. No google logout/login needed.

Example: bard-rs -s ", __Secure-1PSIDTS="

(Maybe unrelated note: Seems like Secure-1PSIDTS and Secure-3PSIDTS have the same value)

widefox commented 11 months ago

Thanks tedsamu . I confirm that works. i.e. bard-rs --session "<__Secure-1PSID value>, __Secure-1PSIDTS=<__Secure-1PSIDTS value>" or put in .env: SESSION_ID=<__Secure-1PSID value>,__Secure-1PSIDTS=<__Secure-1PSIDTS value> then bard-rs

Alfex4936 commented 11 months ago

Sorry for the late! just uploaded the new version!

cargo install bard-rs -f

image