EvanZhouDev / bard-ai

A lightweight library to access Google Bard.
https://www.npmjs.com/package/bard-ai
GNU General Public License v3.0
117 stars 31 forks source link

🐛 [BUG]: Error: Could not use your Cookie. Make sure that you copied correctly the Cookie with name __Secure-1PSID exactly. If you are sure your cookie is correct, you may also have reached your rate limit. #50

Closed alokid closed 1 year ago

alokid commented 1 year ago

Prerequisites

Bug Description

image even though I use the same key, but using the bard-ai module gets this error, but if using the googlebard module, it works.

Reproduction Steps

let bot = new Bard(bardKey);

console.log(await bot.ask("Hello world!")); console.log(await bot.ask("What is 1+1?")); console.log(await bot.ask("What about 2+2?")); console.log(await bot.ask("Goodbye."));

Other information

No response

Occurance Rate

I can reproduce this bug 100% of the time.

EvanZhouDev commented 1 year ago

I assume your key starts something like “__Secure-1PSID=”

If this is so, you can remove this for bard-ai.

If it starts with a non-1 PSID, put it as a JSON in the same place you put a cookie, like this:

{
    “__Secure-2PSID”: “YOUR_COOKIE”
}
alokid commented 1 year ago

even though yesterday's version of the bard-ai module was working, the latest update, made it encounter an error

EvanZhouDev commented 1 year ago

Again, what format is the string you are putting into the object?

alokid commented 1 year ago

import Bard from "bard-ai";

let myBard = new Bard(mycookie);

console.log(await myBard.ask("Hello, world!"));

EvanZhouDev commented 1 year ago

What are you putting into new Bard()? Does it start with “__Secure-PSID”?

alokid commented 1 year ago

without text "__Secure-1PSID", but I only entered cookies

EvanZhouDev commented 1 year ago

Hmm… very strange. I will have to look into it tomorrow. Have you tried using the PSIDTS? (In the FAQ)

alokid commented 1 year ago

I have tried many times, changing google accounts. the results are not satisfactory.

xLSX285 commented 1 year ago

Same here, my __Secure-1PSID or PSIDTS cookie doesn't seem to work with 2.0.0, when I go back to 1.5.4 it works just fine on my end.

EvanZhouDev commented 1 year ago

So sorry, should be all fixed now...

EvanZhouDev commented 1 year ago

By the way @xLSX285 your PSIDTS should be used alongside your PSID... not alone, like this:

let bot = new Bard({
    "__Secure-1PSID": PSID,
    "__Secure-1PSIDTS": PSIDTS
})

Hope this helps!

alokid commented 1 year ago

image let bot = new Bard({ "Secure-1PSID": bardKey, "Secure-1PSIDTS": bardKey2 })

console.log(await bot.ask(m.text)); m.reply(await bot.ask(m.text))

Latest Version

ThatXliner commented 1 year ago

image let bot = new Bard({ "Secure-1PSID": bardKey, "Secure-1PSIDTS": bardKey2 })

console.log(await bot.ask(m.text)); m.reply(await bot.ask(m.text))

Latest Version

Are you sure you're updated to v2? and how are you importing bard?

xLSX285 commented 1 year ago

By the way @xLSX285 your PSIDTS should be used alongside your PSID... not alone, like this:

let bot = new Bard({
    "__Secure-1PSID": PSID,
    "__Secure-1PSIDTS": PSIDTS
})

Hope this helps!

Oh right.. can confirm it works now for me on 2.0.1! Kind of annoying though because my PSIDTS expires already like after 10 minutes or so.

alokid commented 1 year ago

image let bot = new Bard({ "Secure-1PSID": bardKey, "Secure-1PSIDTS": bardKey2 }) console.log(await bot.ask(m.text)); m.reply(await bot.ask(m.text)) Latest Version

Are you sure you're updated to v2? and how are you importing bard?

import Bard from "bard-ai";

let myBard = new Bard(COOKIE __Secure-1PSID);

console.log(await myBard.ask("Hello, world!"));

KilluaBot commented 1 year ago

Command Error

Bard is not a constructor

anirudhv commented 1 year ago

Try logging out, logging in again, and getting a new cookie. That works.

EvanZhouDev commented 1 year ago

Seems like this is all fixed, to some degree. Closing for now.