JimmyDaddy / vscode-bard

bard extension for vscode
https://marketplace.visualstudio.com/items?itemName=jimmydaddy.vscode-bard
MIT License
16 stars 3 forks source link

VSCode-Bard DOES NOT WORK... Cookie errors for plugins and API wrapper... still reporting cookie problems #11

Open richlysakowski opened 9 months ago

richlysakowski commented 9 months ago

I added the cookie as instructed.

Here's my prompt.

You What is the os module in the Python Standard Library?

Bard ERROR MESSAGE: "Failed to get bard params SNlM0e, pls retry or check your cookies. You can get your cookie by following the instructions provided in this link." Google is blocking this VSCode extension, the same way it blocks Bard-API and other wrappers around the Bard Chat interface in a browser.

It looks like Google is forcing everyone to use their PALM API package.

https://github.com/dsdanielpark/Bard-API/issues/155

Too bad. Great idea. Not working though.

Big Tech, Cloud Monopoly Sledge Hammer comes down on developers again!!!

JimmyDaddy commented 9 months ago

I have tried this after reseting cookie, it works:

截屏2023-10-16 14 37 10

you can reset your cookie and try again

ZdenekMerka commented 8 months ago

What does mean 'reset cookie', How can I do it. Should I reset cookie in browser or in VS code. Can you provide instructions. Thank very much.

ZdenekMerka commented 8 months ago

Today I try to solution 2 and it works.

HandisableL commented 7 months ago

I try Solution 1&2,Both failed in Firefox,But solution 2 OK in new edge.

stefanbosak commented 7 months ago

Hi to all,

for accessing to Google Bard service more cookies are required in general. If following cookies are used it is not needed to have opened session to bard.google.com in any of web browser, but keep in mind that related Secure cookies might be regenerated after re-login to Google services). No changes on the side of VSCode plugin are needed, plugin has sufficient support in codebase to proceed all related cookies, just need to be provided as string consist of separated cookies like following pattern: Secure-=;__Secure-=;

Recommendation for extracting of cookies - Firefox users (feel free to align to your case/preference): prerequisites: Linux OS, sqlite3, xclip, Firefox installed

Firefox ESR: sqlite3 ~/.mozilla/firefox/*.default-esr/cookies.sqlite """SELECT name, value FROM moz_cookies WHERE host LIKE '%.google.com' AND name LIKE '__Secure-1PSID%'""" | sed 's/$/;/g;s/|//g' | xclip -selection clipboard

Firefox Release: sqlite3 ~/.mozilla/firefox/*.default-release/cookies.sqlite """SELECT name, value FROM moz_cookies WHERE host LIKE '%.google.com' AND name LIKE '__Secure-1PSID%'""" | sed 's/$/;/g;s/|//g' | xclip -selection clipboard

Note for Firefox data gathering: Based on many reasons extracting of SQLlite data from Firefox is possible only when given instance of Firefox is not running, it means when Firefox is running there is lock on SQLlite database of given Firefox instance. Above mentioned SQLlite aproach for Firefox is reliable way for automating data gathering (just still need to take care carefully about data lifecycle changes dependend on service of given provider which is quite common, e. g. cookies might be regenerated after relogin to service, etc...). For Firefox advanced users using Firefox containers (or Firefox profiles) and eventually special configuration - they do not need to worry about some cases too much/very frequently.

Note for other browsers There are more possibilities how to extract __Secure cookie data via other browsers, but might need more advanced approaches to handle data gathering really reliable way from mid/long term perspective.

When needed just update plugin settings - provide up-to-data cookie data.

Suggestion for plugin owner/developer: Would be really valuable if given cookie parameter could be stored in dedicated file to be able to automate updating of cookie data parameters.

Thank you.

Stefan

V1x0r commented 6 months ago

I was having a similar issue and found the solution to be rather simple I think.

I was using method 1 to no avail. method 2 didn't work either....probably doing that one wrong. anyway, what worked for me was

using Chrome in windows 11: we go to the cookie in Application. 1 - from the bard.google.com/chat interface i went to Developer Tools ctrl+shift+i 2 - go to Application (just like before) 3 - go to Storage > Cookies and right click on the bard.google.com cookie and select "clear". this will wipe out the cookies for you here. Then Refrersh the page. ctrl+r image

4 - now, you have a new set of cookies. copy the new cookie info... __Secure-1PSID=xxxxxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.

I don't know if the "." at the end of the cookie is necessary but it worked for me just fine. it was part of the cookie in the page.

I hope this helps anyone else.

I'm sure there is a pythonic way of doing this but I didn't care enough to try to do this. i'm sure bard or gpt4 can write that out though. ;)

lacostenycoder commented 6 months ago

The solution for me was to use ONLY THE COOKIE VALUE. So don't try to add the prefix.

This DOES NOT WORK, try to paste => __Secure-1PSID=12345abcde67890fghij12345abcde67890fghij

THIS WORKS!!!! paste only the cookie value => 12345abcde67890fghij12345abcde67890fghij

Maybe update the instructions to be specific about this.

UPDATE: Well this had been working but today it's not. I tried copying cookies from two different browsers, both failed to work. 🤦🏻‍♂️

stefanbosak commented 6 months ago

Hi to all,

cookies are working as expected, implementation of this plugin regarding handling of cookies is really sufficient even from mid/long term perspective (more than reasonable good level of development experience of plugin author). Problem is laying in more clear understanding of cookie usage, mostly because it is not doccumented anywhere so far and might be eventually very confusing for many users (especially groups just following copy & past approaches).

Quick summary for better understanding about required data set to be provided for this plugin (all of the following cookies are really required, it means extract all of them via preferred approach, recommended structure for passing to plugin): Secure-1PSID=;Secure-1PSIDTS=;__Secure-1PSIDCC=;

Note for <datapart{01,02,03}>:

Above described is highly recommended to be able to use of Google Bard service in general.

What is also important to keep in mind:

Summary This plugin is implemented reasonable well/suffiently and problems with cookies are more-less consequences of misunderstanding/inpropper usage (frequently hard to understand related stuff deeply, but just try to read this comment more carefully and issues could be gone)

Thank you for understanding and cooperation in advance, especially many thanks to author of this plugin for his efforts spent on.

Have a nice day.

xuanhop commented 5 months ago

Solution 2 work fine. :) you need to copy and paste all cookies. The first solution is just only one.

daveywoods commented 5 months ago

The solution posted by V1x0r worked for me. Thanks!