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

403 response #24

Closed
OohBen opened this issue Aug 1, 2024 · 19 comments · Fixed by #25, #36 or #49
Closed

403 response #24

OohBen opened this issue Aug 1, 2024 · 19 comments · Fixed by #25, #36 or #49
Labels
bug Something isn't working

Comments

@OohBen
Copy link

OohBen commented Aug 1, 2024

I am having an issue where after successfully logging in, doing claudesync organization ls(or select) on mac(v14.6) results in an error.
Commands (reinstall to show newest version):

(base) xxx@Bens-MBP ~ % pip install claudesync
....
Successfully installed claudesync-0.3.8
(base) xxx@Bens-MBP ~ % claudesync api login claude.ai
....
Please enter your sessionKey: sk-ant-xxx
Logged in successfully.
(base) xxx@Bens-MBP ~ % claudesync organization ls
ERROR:claudesync.providers.claude_ai:Received a 403 Forbidden error. Your session key might be invalid. Please try logging out and logging in again. If the issue persists, you can try using the claude.ai-curl provider as a workaround:
claudesync api logout
claudesync api login claude.ai-curl
...
(base) xxx@Bens-MBP ~ % claudesync api logout
Logged out successfully.
(base) xxx@Bens-MBP ~ % claudesync api login claude.ai-curl
...
Please enter your sessionKey: sk-ant-xxx
Logged in successfully.

(base) xxx@Bens-MBP ~ % claudesync organization ls         
Traceback (most recent call last):
  File "/opt/anaconda3/bin/claudesync", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/opt/anaconda3/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/lib/python3.11/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/lib/python3.11/site-packages/click/decorators.py", line 45, in new_func
    return f(get_current_context().obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/lib/python3.11/site-packages/claudesync/utils.py", line 218, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/lib/python3.11/site-packages/claudesync/cli/organization.py", line 18, in ls
    organizations = provider.get_organizations()
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/lib/python3.11/site-packages/claudesync/providers/claude_ai_curl.py", line 150, in get_organizations
    return [{"id": org["uuid"], "name": org["name"]} for org in response]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/lib/python3.11/site-packages/claudesync/providers/claude_ai_curl.py", line 150, in <listcomp>
    return [{"id": org["uuid"], "name": org["name"]} for org in response]
                   ~~~^^^^^^^^
TypeError: string indices must be integers, not 'str'

Curl is installed:

(base) xxx@Bens-MBP ~ % curl
curl: try 'curl --help' for more information
@OohBen OohBen added the bug Something isn't working label Aug 1, 2024
@jahwag
Copy link
Owner

jahwag commented Aug 1, 2024

Hi, like I mentioned last time, can you share the output of https://claude.ai/api/organizations from your browser?

@OohBen
Copy link
Author

OohBen commented Aug 1, 2024

Sure:

// 20240801165943
// https://claude.ai/api/organizations

[
  {
    "uuid": "a621cc80-xxxx",
    "name": "xxx G",
    "settings": {
      "claude_console_privacy": "default_private",
      "allowed_invite_domains": null
    },
    "capabilities": [
      "chat",
      "claude_pro"
    ],
    "rate_limit_tier": "default_claude_ai",
    "billing_type": "stripe_subscription",
    "free_credits_status": "available",
    "data_retention": "default",
    "api_disabled_reason": null,
    "api_disabled_until": null,
    "billable_usage_paused_until": null,
    "created_at": "2023-08-09T15:36:31.764797Z",
    "updated_at": "2024-05-27T21:08:32.940249Z",
    "active_flags": [
      
    ]
  },
  {
    "uuid": "760aa33f-xxxx",
    "name": "myself",
    "settings": {
      "claude_console_privacy": "default_private",
      "allowed_invite_domains": null
    },
    "capabilities": [
      "api"
    ],
    "rate_limit_tier": "auto_api_evaluation",
    "billing_type": "api_evaluation",
    "free_credits_status": "available",
    "data_retention": "default",
    "api_disabled_reason": "out_of_credits",
    "api_disabled_until": null,
    "billable_usage_paused_until": null,
    "created_at": "2024-03-26T05:08:49.011380Z",
    "updated_at": "2024-03-26T05:08:49.011380Z",
    "active_flags": [
      
    ]
  }
]

@jahwag jahwag linked a pull request Aug 1, 2024 that will close this issue
@jahwag jahwag linked a pull request Aug 1, 2024 that will close this issue
@jahwag
Copy link
Owner

jahwag commented Aug 1, 2024

Please retry with 0.4.0

@OohBen
Copy link
Author

OohBen commented Aug 1, 2024

Error is still present:

(base) xxx@Bens-MBP ~ % pip install claudesync
…
Successfully installed claudesync-0.4.0
(base) xxx@Bens-MBP ~ % claudesync api login claude.ai
…
Please enter your sessionKey: sk-ant-xxx
Logged in successfully.
(base) xxx@Bens-MBP ~ % claudesync organization ls
2024-08-01 18:53:56,157 - ERROR - Received a 403 Forbidden error. Your session key might be invalid. Please try logging out and logging in again. If the issue persists, you can try using the claude.ai-curl provider as a workaround:
claudesync api logout
claudesync api login claude.ai-curl
…
(base) xxx@Bens-MBP ~ % claudesync api logout
Logged out successfully.
(base) xxx@Bens-MBP ~ % claudesync api login claude.ai-curl
…
Please enter your sessionKey: sk-ant-xxx
Logged in successfully.
(base) xxx@Bens-MBP ~ % claudesync organization ls         
Traceback (most recent call last):
  File "/opt/anaconda3/bin/claudesync", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/opt/anaconda3/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/lib/python3.11/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/lib/python3.11/site-packages/click/decorators.py", line 45, in new_func
    return f(get_current_context().obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/lib/python3.11/site-packages/claudesync/utils.py", line 218, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/lib/python3.11/site-packages/claudesync/cli/organization.py", line 18, in ls
    organizations = provider.get_organizations()
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/lib/python3.11/site-packages/claudesync/providers/base_claude_ai.py", line 36, in get_organizations
    return [
           ^
  File "/opt/anaconda3/lib/python3.11/site-packages/claudesync/providers/base_claude_ai.py", line 39, in <listcomp>
    if set(["chat", "claude_pro"]).issubset(set(org.get("capabilities", [])))
                                                ^^^^^^^
AttributeError: 'str' object has no attribute 'get'

@jahwag
Copy link
Owner

jahwag commented Aug 2, 2024

Please download the latest version by running pip install claudesync==0.4.1. and then execute claudesync api logout before trying to log in again. If the problem persists, set the log level to DEBUG by running:

claudesync config set log_level DEBUG

After that, post the output here so I can assist you further. Thank you!

@OohBen
Copy link
Author

OohBen commented Aug 3, 2024

Ok tried with 0.4.1 didn't work, can't login now but it seems to be because now to have successful login orgs need to be listed. Heres the debug stuff:

(base) xxx@Bens-MBP ~ % claudesync api login claude.ai
---
Please enter your sessionKey: sk-ant-sid01-xxx
2024-08-03 02:49:51,110 - DEBUG - Making GET request to https://claude.ai/api/organizations
2024-08-03 02:49:51,110 - DEBUG - Headers: {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0', 'Origin': 'https://claude.ai', 'Referer': 'https://claude.ai/projects', 'Accept': '*/*', 'Accept-Encoding': 'gzip, deflate, zstd', 'Accept-Language': 'en-US,en;q=0.5', 'anthropic-client-sha': 'unknown', 'anthropic-client-version': 'unknown', 'Connection': 'keep-alive', 'Sec-Fetch-Dest': 'empty', 'Sec-Fetch-Mode': 'cors', 'Sec-Fetch-Site': 'same-origin'}
2024-08-03 02:49:51,110 - DEBUG - Cookies: {'sessionKey': 'sk-ant-sid01-xxx', 'CH-prefers-color-scheme': 'dark', 'anthropic-consent-preferences': '{"analytics":true,"marketing":true}'}
2024-08-03 02:49:51,457 - DEBUG - Response status code: 403
2024-08-03 02:49:51,457 - DEBUG - Response headers: {'Date': 'Sat, 03 Aug 2024 06:49:51 GMT', 'Content-Type': 'application/json', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'Set-Cookie': '__cf_bm=JfXfX9eNdFWi.J.Kgna36ZMkrYU1_WekW_Hq4Pz3Pxg-1722667791-1.0.1.1-UTx9VMW_5uEu8Hs0sEXetMySDjwmn02t99LdO9Ve0zCfnn2p3AsgSGri8fQx6rSGZ1RipGkedIIzZTo_HV_81w; path=/; expires=Sat, 03-Aug-24 07:19:51 GMT; domain=.claude.ai; HttpOnly; Secure; SameSite=None', 'Vary': 'Accept-Encoding', 'Server': 'cloudflare', 'CF-RAY': '8ad45ec08cf818ee-EWR', 'Content-Encoding': 'gzip', 'alt-svc': 'h3=":443"; ma=86400'}
2024-08-03 02:49:51,457 - DEBUG - Response content: {"error":{"message":"We are unable to serve your request","type":"permission_error"}}...
2024-08-03 02:49:51,457 - ERROR - Received a 403 Forbidden error. Your session key might be invalid. Please try logging out and logging in again. If the issue persists, you can try using the claude.ai-curl provider as a workaround:
claudesync api logout
claudesync api login claude.ai-curl
Failed to retrieve organizations. Please enter a valid sessionKey.
Please enter your sessionKey: ^CAborted!
(base) xxx@Bens-MBP ~ % claudesync api logout

Logged out successfully.
(base) xxx@Bens-MBP ~ % claudesync api login claude.ai-curl
---
Please enter your sessionKey: sk-ant-sid01-xxx
2024-08-03 02:50:04,057 - DEBUG - Got HTTP 403
2024-08-03 02:50:04,058 - ERROR - HTTP request failed with status code 403. Response content: {"error":{"message":"We are unable to serve your request","type":"permission_error"}}. Request headers: ['-H', 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0', '-H', 'Cookie: sessionKey=sk-ant-xxx', '-H', 'Content-Type: application/json']
Failed to retrieve organizations. Please enter a valid sessionKey.


@jahwag
Copy link
Owner

jahwag commented Aug 3, 2024

Can you successfully execute the curl command in your terminal?

curl -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0' \
     -H 'Cookie: sessionKey=sk-ant-xxx' \
     -H 'Content-Type: application/json' \
     https://claude.ai/api/organizations

@OohBen
Copy link
Author

OohBen commented Aug 3, 2024

No I get an error: {"error":{"message":"We are unable to serve your request","type":"permission_error"}},
If I use postman proxy and use my web browser, I get the same error:

  "error": {
    "message": "We are unable to serve your request",
    "type": "permission_error"
  }
}

@jahwag
Copy link
Owner

jahwag commented Aug 3, 2024

Please open your browser’s developer tools and navigate to https://claude.ai. Create a new project and upload a file to it. Could you then share the request and response headers from this process?

@OohBen
Copy link
Author

OohBen commented Aug 3, 2024

To make the project (from the POST request to https://api.claude.ai/api/organizations/xxx/projects):
Request headers:

:authority: api.claude.ai
:method: POST
:path: /api/organizations/<ORG_ID>/projects
:scheme: https

accept: */*
accept-encoding: gzip, deflate, br, zstd
accept-language: en-US,en;q=0.9
anthropic-client-sha: unknown
anthropic-client-version: unknown
content-length: 63
content-type: application/json

cookie:
  CH-prefers-color-scheme=dark;
  __ssid=<SSID>;
  lastActiveOrg=<ORG_ID>;
  intercom-device-id-lupk8zyo=<DEVICE_ID>;
  user-sidebar-pinned=false;
  __stripe_mid=<STRIPE_MID>;
  _gcl_au=1.1.<VALUE>;
  _fbp=fb.1.<VALUE>;
  _rdt_uuid=<UUID>;
  sessionKey=<SESSION_KEY>;
  __cf_bm=<CF_BM>;
  cf_clearance=<CF_CLEARANCE>;
  intercom-session-lupk8zyo=<INTERCOM_SESSION>

dnt: 1
origin: https://claude.ai
priority: u=1, i
referer: https://claude.ai/

sec-ch-ua: "Not)A;Brand";v="99", "Google Chrome";v="127", "Chromium";v="127"
sec-ch-ua-mobile: ?0
sec-ch-ua-platform: "macOS"
sec-fetch-dest: empty
sec-fetch-mode: cors
sec-fetch-site: same-site

user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36

Response headers:

access-control-allow-credentials: true
access-control-allow-origin: https://claude.ai

alt-svc: h3=":443"; ma=86400

cf-cache-status: DYNAMIC
cf-ray: <CF_RAY>

content-length: 354
content-type: application/json

date: Sat, 03 Aug 2024 22:25:27 GMT
request-id: <REQUEST_ID>

server: cloudflare

set-cookie:
  sessionKey=<SESSION_KEY>;
  Domain=.claude.ai;
  expires=Mon, 02 Sep 2024 22:25:27 GMT;
  HttpOnly; Path=/;
  SameSite=lax; Secure

vary: Origin
via: 1.1 google

x-cloud-trace-context: <TRACE_CONTEXT>

When uploading a file (POST to https://api.claude.ai/api/organizations/xxx/projects/xxx/docs):
Request headers:

:authority: api.claude.ai
:method: POST
:path: /api/organizations/<ORG_ID>/projects/<PROJECT_ID>/docs
:scheme: https

accept: */*
accept-encoding: gzip, deflate, br, zstd
accept-language: en-US,en;q=0.9
anthropic-client-sha: unknown
anthropic-client-version: unknown
content-length: 10211
content-type: application/json

cookie:
  CH-prefers-color-scheme=dark;
  __ssid=<SSID>;
  lastActiveOrg=<ORG_ID>;
  intercom-device-id-lupk8zyo=<DEVICE_ID>;
  user-sidebar-pinned=false;
  __stripe_mid=<STRIPE_MID>;
  _gcl_au=1.1.<VALUE>;
  _fbp=fb.1.<VALUE>;
  _rdt_uuid=<UUID>;
  sessionKey=<SESSION_KEY>;
  __cf_bm=<CF_BM>;
  cf_clearance=<CF_CLEARANCE>;
  intercom-session-lupk8zyo=<INTERCOM_SESSION>

dnt: 1
origin: https://claude.ai
priority: u=1, i
referer: https://claude.ai/

sec-ch-ua: "Not)A;Brand";v="99", "Google Chrome";v="127", "Chromium";v="127"
sec-ch-ua-mobile: ?0
sec-ch-ua-platform: "macOS"
sec-fetch-dest: empty
sec-fetch-mode: cors
sec-fetch-site: same-site

user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36

Response:

access-control-allow-credentials: true
access-control-allow-origin: https://claude.ai

alt-svc: h3=":443"; ma=86400

cf-cache-status: DYNAMIC
cf-ray: <CF_RAY>

content-length: 10354
content-type: application/json

date: Sat, 03 Aug 2024 22:30:19 GMT
request-id: <REQUEST_ID>

server: cloudflare

set-cookie:
  sessionKey=<SESSION_KEY>;
  Domain=.claude.ai;
  expires=Mon, 02 Sep 2024 22:30:19 GMT;
  HttpOnly; Path=/;
  SameSite=lax; Secure

vary: Origin
via: 1.1 google

x-cloud-trace-context: <TRACE_CONTEXT>

@jahwag jahwag linked a pull request Aug 5, 2024 that will close this issue
@jahwag
Copy link
Owner

jahwag commented Aug 5, 2024

I’m not certain if this will resolve your issue, but you might want to try the latest release: v0.4.7. It includes recent updates that could address the problem you're experiencing.

@jahwag jahwag changed the title Doing organization ls or select results in an error 403 response Aug 8, 2024
@HotelMoted
Copy link

HotelMoted commented Aug 8, 2024

OS: Ubuntu 24.04
Python: 3.12.3
ClaudeSync: 0.4.9

(venv) tyler@server:~/test$ claudesync config ls
log_level: INFO
upload_delay: 0.5
max_file_size: 32768
two_way_sync: False
curl_use_file_input: False
session_key: None
session_key_expiry: None
active_provider: None
active_organization_id: None
active_project_id: None
active_project_name: None
local_path: None
(venv) tyler@server:~/test$ claudesync api login claude.ai
To obtain your session key, please follow these steps:
1. Open your web browser and go to https://claude.ai
2. Log in to your Claude account if you haven't already
3. Once logged in, open your browser's developer tools:
   - Chrome/Edge: Press F12 or Ctrl+Shift+I (Cmd+Option+I on Mac)
   - Firefox: Press F12 or Ctrl+Shift+I (Cmd+Option+I on Mac)
   - Safari: Enable developer tools in Preferences > Advanced, then press Cmd+Option+I
4. In the developer tools, go to the 'Application' tab (Chrome/Edge) or 'Storage' tab (Firefox)
5. In the left sidebar, expand 'Cookies' and select 'https://claude.ai'
6. Locate the cookie named 'sessionKey' and copy its value. Ensure that the value is not URL-encoded.
Please enter your sessionKey: sk-ant-sid01-crazylongstring
Please enter the expires time for the sessionKey [Sat, 07 Sep 2024 21:29:39 UTC]: Sat, 07 Sep 2024 21:29:05 UTC
2024-08-08 21:29:51,825 - ERROR - Received a 403 Forbidden error. Your session key might be invalid. Please try logging out and logging in again. If the issue persists, you can try using the claude.ai-curl provider as a workaround:
claudesync api logout
claudesync api login claude.ai-curl
Received a 403 Forbidden error. Your session key might be invalid. Please try logging out and logging in again. If the issue persists, you can try using the claude.ai-curl provider as a workaround:
claudesync api logout
claudesync api login claude.ai-curl
Failed to retrieve organizations. Please enter a valid sessionKey.
Please enter your sessionKey: ^X^CAborted!
(venv) tyler@server:~/test$ claudesync api login claude.ai-curl
To obtain your session key, please follow these steps:
1. Open your web browser and go to https://claude.ai
2. Log in to your Claude account if you haven't already
3. Once logged in, open your browser's developer tools:
   - Chrome/Edge: Press F12 or Ctrl+Shift+I (Cmd+Option+I on Mac)
   - Firefox: Press F12 or Ctrl+Shift+I (Cmd+Option+I on Mac)
   - Safari: Enable developer tools in Preferences > Advanced, then press Cmd+Option+I
4. In the developer tools, go to the 'Application' tab (Chrome/Edge) or 'Storage' tab (Firefox)
5. In the left sidebar, expand 'Cookies' and select 'https://claude.ai'
6. Locate the cookie named 'sessionKey' and copy its value. Ensure that the value is not URL-encoded.
Please enter your sessionKey: sk-ant-sid01-crazylongstring
Please enter the expires time for the sessionKey [Sat, 07 Sep 2024 21:30:03 UTC]: Sat, 07 Sep 2024 21:29:05 UTC
2024-08-08 21:30:13,286 - ERROR - HTTP request failed with status code 403. Response content: {"error":{"message":"We are unable to serve your request","type":"permission_error"}}. Request headers: ['-H', 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0', '-H', 'Cookie: sessionKey=sk-ant-sid01-crazylongstring', '-H', 'Content-Type: application/json']
HTTP request failed with status code 403. Response content: {"error":{"message":"We are unable to serve your request","type":"permission_error"}}. Request headers: ['-H', 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0', '-H', 'Cookie: sessionKey=sk-ant-sid01-crazylongstring', '-H', 'Content-Type: application/json']
Failed to retrieve organizations. Please enter a valid sessionKey.

@jahwag
Copy link
Owner

jahwag commented Aug 14, 2024

I've consistently reproduced this issue with all Python versions later than 3.11.3.

To avoid this problem, please install Python 3.11.3 and use the "claude.ai" provider instead of "claude.ai-curl" for optimal performance. If you use the "claude.ai-curl" provider, you may encounter error 43 due to this issue. Upgrading curl should resolve that error but that provider will eventually be deprecated.

# Specify the Python version as a build argument
ARG PYTHON_VERSION=3.11.3

# Use the official Python image as a base, parameterized by the Python version
FROM python:${PYTHON_VERSION}-slim

# Set the working directory in the container
WORKDIR /app

# Copy the requirements file into the container
COPY requirements.txt .

# Install the dependencies and claudesync
RUN pip install --no-cache-dir -r requirements.txt && \
    pip install --no-cache-dir claudesync

# Copy the application code into the container
COPY . .

# Create the .claudesync directory
RUN mkdir -p /root/.claudesync

# Create and populate the config.json file
RUN echo '{ \
    "session_key": "session-key-here", \
    "session_key_expiry": "2099-09-13T22:42:50", \
    "active_provider": "claude.ai", \
    "active_organization_id": "your_org_id_here", \
    "active_project_id": "your_project_id_here", \
    "active_project_name": "Your Project Name", \
    "local_path": "/app" \
}' > /root/.claudesync/config.json

# Set the command to run claudesync organization ls
CMD claudesync organization ls && echo "ClaudeSync setup successful" || (echo "ClaudeSync setup failed" && exit 1)

@jahwag jahwag linked a pull request Aug 19, 2024 that will close this issue
Copy link

This issue has been marked as stale due to 14 days of inactivity. Please remove the stale label or comment to keep it open, otherwise, it will be closed in 3 days.

@github-actions github-actions bot added the Stale label Aug 29, 2024
@ayushin
Copy link

ayushin commented Aug 29, 2024

lastest version produces 403

$ claudesync auth login
Choose provider (claude.ai) [claude.ai]: 
A session key is required to call: https://api.claude.ai/api
To obtain your session key, please follow these steps:
1. Open your web browser and go to https://claude.ai
2. Log in to your Claude account if you haven't already
3. Once logged in, open your browser's developer tools:
   - Chrome/Edge: Press F12 or Ctrl+Shift+I (Cmd+Option+I on Mac)
   - Firefox: Press F12 or Ctrl+Shift+I (Cmd+Option+I on Mac)
   - Safari: Enable developer tools in Preferences > Advanced, then press Cmd+Option+I
4. In the developer tools, go to the 'Application' tab (Chrome/Edge) or 'Storage' tab (Firefox)
5. In the left sidebar, expand 'Cookies' and select 'https://claude.ai'
6. Locate the cookie named 'sessionKey' and copy its value. Ensure that the value is not URL-encoded.
Please enter your sessionKey: 
Please enter the expires time for the sessionKey (optional) [Sat, 28 Sep 2024 10:58:39 UTC]: 
Received a 403 Forbidden error.

@jahwag
Copy link
Owner

jahwag commented Aug 29, 2024

# Specify the Python version as a build argument
ARG PYTHON_VERSION=3.12.5

# Use the official Python image as a base, parameterized by the Python version
FROM python:${PYTHON_VERSION}-slim

# Set the working directory in the container
WORKDIR /app

# Copy the requirements file into the container
COPY requirements.txt .

# Install the dependencies and claudesync
RUN pip install --no-cache-dir -r requirements.txt && \
    pip install --no-cache-dir claudesync

# Copy the application code into the container
COPY . .

# Create the .claudesync directory
RUN mkdir -p /root/.claudesync

# Create and populate the config.json file
RUN echo '{"session_key": "you-session-key", "session_key_expiry": "2099-09-28T11:09:34"}' > /root/.claudesync/claude.ai.key

# Set the command to run claudesync organization ls
CMD claudesync organization ls && echo "ClaudeSync setup successful" || (echo "ClaudeSync setup failed" && exit 1)

@ayushin This Dockerfile successfully outputs my organization. Please confirm it works for you.

@github-actions github-actions bot removed the Stale label Aug 30, 2024
Copy link

This issue has been marked as stale due to 14 days of inactivity. Please remove the stale label or comment to keep it open, otherwise, it will be closed in 3 days.

@github-actions github-actions bot added the Stale label Sep 13, 2024
@zhc-1999
Copy link

zhc-1999 commented Sep 13, 2024

m1 The latest version appears
Received a 403 Forbidden error.
Failed to retrieve organizations. Please enter a valid sessionKey.

@jahwag
Copy link
Owner

jahwag commented Sep 13, 2024

m1 The latest version appears Received a 403 Forbidden error. Failed to retrieve organizations. Please enter a valid sessionKey.

Thank you for reporting this issue. To assist you effectively, please:

  • Complete the bug report form.
  • Provide the exact error message and your system details.
  • Confirm if you've followed the troubleshooting steps suggested to other users.

Without this information, I cannot diagnose or resolve the problem. If you need clarification on any point, please ask.

@github-actions github-actions bot removed the Stale label Sep 14, 2024
@jahwag jahwag closed this as completed Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
5 participants