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

You should set 'COOKIE' in 'Config.conf' file for the Claude or login with a browser to Claude.ai account. #35

Open
colin4k opened this issue Jun 23, 2024 · 3 comments

Comments

@colin4k
Copy link

colin4k commented Jun 23, 2024

I had set cookie value in the 'Config.conf', but it still failed.

INFO:root:claude_routes.py
INFO:root:gemini_routes.py
INFO:root:v1_routes.py
INFO:root:http_routes.py
INFO:root:http_routes.py.initialize_cookies
INFO:root:utility.py./getCookie_Claude
{'Error': "You should set 'COOKIE' in 'Config.conf' file for the Claude or login with a browser to Claude.ai account."}
INFO:root:utility.py./getCookie_Gemini
Traceback (most recent call last):
File "/home/colin/workspace/WebAI-to-API/webai2api/webai2api/utils/utility.py", line 118, in getCookie_Gemini
cookie = get_cookiestring("Google")
File "/home/colin/workspace/WebAI-to-API/webai2api/webai2api/utils/utility.py", line 66, in get_cookiestring
domain = domains[service_name]
KeyError: 'Google'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/colin/workspace/WebAI-to-API/webai2api/run.py", line 3, in
from webai2api.main import app
File "/home/colin/workspace/WebAI-to-API/webai2api/webai2api/main.py", line 5, in
from .routes.http_routes import web_ui_middleware
File "/home/colin/workspace/WebAI-to-API/webai2api/webai2api/routes/http_routes.py", line 32, in
initialize_cookies()
File "/home/colin/workspace/WebAI-to-API/webai2api/webai2api/routes/http_routes.py", line 27, in initialize_cookies
COOKIE_GEMINI = utility.getCookie_Gemini()
File "/home/colin/workspace/WebAI-to-API/webai2api/webai2api/utils/utility.py", line 127, in getCookie_Gemini
cookies = browser_cookie3.load(domain_name=domain)
File "/home/colin/anaconda3/envs/claude/lib/python3.10/site-packages/browser_cookie3/init.py", line 1233, in load
for cookie in cookie_fn(domain_name=domain_name):
File "/home/colin/anaconda3/envs/claude/lib/python3.10/site-packages/browser_cookie3/init.py", line 1160, in chrome
return Chrome(cookie_file, domain_name, key_file).load()
File "/home/colin/anaconda3/envs/claude/lib/python3.10/site-packages/browser_cookie3/init.py", line 626, in init
super().init(browser='Chrome', cookie_file=cookie_file,
File "/home/colin/anaconda3/envs/claude/lib/python3.10/site-packages/browser_cookie3/init.py", line 416, in init
self.__add_key_and_cookie_file(**kwargs)
File "/home/colin/anaconda3/envs/claude/lib/python3.10/site-packages/browser_cookie3/init.py", line 431, in __add_key_and_cookie_file
USE_DBUS_LINUX).get_password(os_crypt_name)
File "/home/colin/anaconda3/envs/claude/lib/python3.10/site-packages/browser_cookie3/init.py", line 232, in get_password
return self.__get_secretstorage_password(os_crypt_name)
File "/home/colin/anaconda3/envs/claude/lib/python3.10/site-packages/browser_cookie3/init.py", line 247, in __get_secretstorage_password
return self.__methods_map.get('secretstorage')(schema, os_crypt_name)
File "/home/colin/anaconda3/envs/claude/lib/python3.10/site-packages/browser_cookie3/init.py", line 303, in __get_secretstorage_item_jeepney
with _JeepneyConnection(*args) as connection:
File "/home/colin/anaconda3/envs/claude/lib/python3.10/site-packages/browser_cookie3/init.py", line 195, in enter
self.__connection = open_dbus_connection()
File "/home/colin/anaconda3/envs/claude/lib/python3.10/site-packages/jeepney/io/blocking.py", line 342, in open_dbus_connection
sock = prep_socket(bus_addr, enable_fds, timeout=auth_timeout)
File "/home/colin/anaconda3/envs/claude/lib/python3.10/site-packages/jeepney/io/blocking.py", line 310, in prep_socket
with_sock_deadline(sock.connect, addr)
File "/home/colin/anaconda3/envs/claude/lib/python3.10/site-packages/jeepney/io/blocking.py", line 307, in with_sock_deadline
return meth(*args)
FileNotFoundError: [Errno 2] No such file or directory

@VariantConst
Copy link

have the same problem

@kairushinjuu
Copy link

me too, it seems the claude session cookies have changed format

@badunch
Copy link

badunch commented Jul 23, 2024

There is a way to authenticate using a config file. if you look in the utils/utility.py file. You will see

gemini_session_names = {
"bardts": "__Secure-1PSIDTS",
"bardcc": "__Secure-1PSIDCC"
}
default_gemini_session_name = "__Secure-1PSID"

I am assuming those would be the values you would be from the session. Which you can find under the Ppplication tap of the developer options on chrome. Under cookies. Try to authenticate manually?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants