Skip to content
This repository has been archived by the owner on Aug 10, 2023. It is now read-only.

[Bug]: ssl handshake error with explorer.api.openai.com #1236

Closed
1 task done
zer0mania opened this issue Mar 30, 2023 · 59 comments
Closed
1 task done

[Bug]: ssl handshake error with explorer.api.openai.com #1236

zer0mania opened this issue Mar 30, 2023 · 59 comments
Assignees
Labels
stale WIP Work in Progress

Comments

@zer0mania
Copy link

Is there an existing issue for this?

  • I have searched the existing issues and checked the recent builds/commits

What happened?

While running an api on replit with flask, I restarted the repl to make some changes for logging.

Steps to reproduce the problem

  1. Import revChatGPT and configurate the chatbot with session token

What should have happened?

It should authenticate with no issues

Version where the problem happens

Name: revChatGPT
Version: 4.0.11
Summary: ChatGPT is a reverse engineering of OpenAI's ChatGPT API
Home-page: https://github.com/acheong08/ChatGPT
Author: Antonio Cheong
Author-email: [email protected]
License: GNU General Public License v2.0
Location: /home/runner/fr/venv/lib/python3.10/site-packages
Requires: OpenAIAuth, requests, tiktoken, openai, httpx, prompt-toolkit
Required-by:

What Python version are you running this with?

Python 3.10.8

What is your operating system ?

Other/Cloud

Command Line Arguments

No

Console logs

Traceback (most recent call last):
  File "/home/runner/fr/venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 703, in urlopen
    httplib_response = self._make_request(
  File "/home/runner/fr/venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 386, in _make_request
    self._validate_conn(conn)
  File "/home/runner/fr/venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 1042, in _validate_conn
    conn.connect()
  File "/home/runner/fr/venv/lib/python3.10/site-packages/urllib3/connection.py", line 414, in connect
    self.sock = ssl_wrap_socket(
  File "/home/runner/fr/venv/lib/python3.10/site-packages/urllib3/util/ssl_.py", line 449, in ssl_wrap_socket
    ssl_sock = _ssl_wrap_socket_impl(
  File "/home/runner/fr/venv/lib/python3.10/site-packages/urllib3/util/ssl_.py", line 493, in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
  File "/nix/store/hd4cc9rh83j291r5539hkf6qd8lgiikb-python3-3.10.8/lib/python3.10/ssl.py", line 513, in wrap_socket
    return self.sslsocket_class._create(
  File "/nix/store/hd4cc9rh83j291r5539hkf6qd8lgiikb-python3-3.10.8/lib/python3.10/ssl.py", line 1071, in _create
    self.do_handshake()
  File "/nix/store/hd4cc9rh83j291r5539hkf6qd8lgiikb-python3-3.10.8/lib/python3.10/ssl.py", line 1342, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:997)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/runner/fr/venv/lib/python3.10/site-packages/requests/adapters.py", line 489, in send
    resp = conn.urlopen(
  File "/home/runner/fr/venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 787, in urlopen
    retries = retries.increment(
  File "/home/runner/fr/venv/lib/python3.10/site-packages/urllib3/util/retry.py", line 592, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='explorer.api.openai.com', port=443): Max retries exceeded with url: /api/auth/session (Caused by SSLError(SSLError(1, '[SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:997)')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "main.py", line 8, in <module>
    chatbot = Chatbot(config={
  File "/home/runner/fr/venv/lib/python3.10/site-packages/revChatGPT/V1.py", line 58, in wrapper
    out = func(*args, **kwargs)
  File "/home/runner/fr/venv/lib/python3.10/site-packages/revChatGPT/V1.py", line 163, in __init__
    self.__check_credentials()
  File "/home/runner/fr/venv/lib/python3.10/site-packages/revChatGPT/V1.py", line 58, in wrapper
    out = func(*args, **kwargs)
  File "/home/runner/fr/venv/lib/python3.10/site-packages/revChatGPT/V1.py", line 187, in __check_credentials
    self.login()
  File "/home/runner/fr/venv/lib/python3.10/site-packages/revChatGPT/V1.py", line 58, in wrapper
    out = func(*args, **kwargs)
  File "/home/runner/fr/venv/lib/python3.10/site-packages/revChatGPT/V1.py", line 329, in login
    auth.get_access_token()
  File "/home/runner/fr/venv/lib/python3.10/site-packages/OpenAIAuth.py", line 314, in get_access_token
    response = self.session.get(
  File "/home/runner/fr/venv/lib/python3.10/site-packages/requests/sessions.py", line 600, in get
    return self.request("GET", url, **kwargs)
  File "/home/runner/fr/venv/lib/python3.10/site-packages/requests/sessions.py", line 587, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/runner/fr/venv/lib/python3.10/site-packages/requests/sessions.py", line 701, in send
    r = adapter.send(request, **kwargs)
  File "/home/runner/fr/venv/lib/python3.10/site-packages/requests/adapters.py", line 563, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='explorer.api.openai.com', port=443): Max retries exceeded with url: /api/auth/session (Caused by SSLError(SSLError(1, '[SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:997)')))

Additional information

https://replit.com/@zer0mania/fr if you want to see the code

@Germey
Copy link

Germey commented Mar 30, 2023

+1

requests.exceptions.SSLError: HTTPSConnectionPool(host='explorer.api.openai.com', port=443): Max retries exceeded with url: /api/auth/csrf (Caused by SSLError(SSLError(1, '[SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:1129)')))

@Lcatss
Copy link

Lcatss commented Mar 30, 2023

same problem

@acheong08
Copy link
Owner

OpenAIAuth ☠️

OpenAI shut down endpoint. Trying to find alternative endpoints

@Germey
Copy link

Germey commented Mar 30, 2023

@acheong08 Do you think it will get recovered later? Seems their SSL cert is wrong for https://explorer.api.openai.com/, I think OpenAI should be responisble for fixing it.

image

@acheong08
Copy link
Owner

acheong08 commented Mar 30, 2023

It probably won't be fixed. But chat.zhile.io works like a charm.

PUID based or cf_clearance?

@acheong08
Copy link
Owner

I can fix it but would require using a proxy like your's. I don't think users would like their credentials to pass through such a service

@acheong08
Copy link
Owner

acheong08 commented Mar 30, 2023

I also got an API working now. Though with the amount of time access tokens last these days, I think it's better than email/password authentication through somewhat untrusted services

Just gonna delete email/password auth from wiki

@acheong08
Copy link
Owner

Yeah. That's all good. What I mean is for this repo, such a service cannot be adopted. They're welcome to use your UI.

@acheong08
Copy link
Owner

Will ask users for opinions

@Germey
Copy link

Germey commented Mar 30, 2023

I think suspending the support of email/password auth is not a good practice, just because of privacy concern.

Actually, one user can register many ChatGPT accounts based on many "unusual" ways, and these account's email/password does not realted to any user's privacy info. So user actually not care TOO MUCH about leaking the email/password. If user cares, they can choose another way to authenticate instead of using email/password, we can put the Privacy Notice to inform user about it.

@Germey
Copy link

Germey commented Mar 30, 2023

It probably won't be fixed. But chat.zhile.io works like a charm.

PUID based or cf_clearance?

Also curious about the solution.

@AmarnathCJD
Copy link

I also got an API working now. Though with the amount of time access tokens last these days, I think it's better than email/password authentication through somewhat untrusted services

Just gonna delete email/password auth from wiki

Then how are we gonna auth from now own in v1?

@acheong08
Copy link
Owner

Access token. Check wiki

@acheong08
Copy link
Owner

Also curious about the solution.

A proxy server with cf_clearance or puid both works

@peanut996
Copy link
Contributor

Got the same error on my vps, but when i run it on github codespaces, it works well. I do not know why.

@logiccao
Copy link

Will ask users for opinions

before get the API of GPT-4, this is the only way to use gpt-4 in script,So, fix it, please

@peanut996
Copy link
Contributor

Will ask users for opinions

before get the API of GPT-4, this is the only way to use gpt-4 in script,So, fix it, please

why not use the access_token method? it can still work.

@yxjiang
Copy link

yxjiang commented Mar 31, 2023

Use access_token works, but the conversation won't have a history. A new session will be created on every call.

@acheong08
Copy link
Owner

acheong08 commented Mar 31, 2023

Use access_token works, but the conversation won't have a history. A new session will be created on every call.

It will. History is done through conversation_id. All OpenAIAuth does is fetch the access token

Repository owner deleted a comment from peanut996 Mar 31, 2023
@yxjiang
Copy link

yxjiang commented Mar 31, 2023

oh, yes, I see it can be added as option config. Where to find it? I didn't see it from Cookies.

@jirafey
Copy link

jirafey commented Mar 31, 2023

Use access_token works, but the conversation won't have a history. A new session will be created on every call.

It will. History is done through conversation_id. All OpenAIAuth does is fetch the access token

how do we get conversation_id or parent_id?

@AkiyaKiko
Copy link

Use access_token works, but the conversation won't have a history. A new session will be created on every call.

It will. History is done through conversation_id. All OpenAIAuth does is fetch the access token

how do we get conversation_id or parent_id?

same question, how can i get conversation_id

@jirafey
Copy link

jirafey commented Mar 31, 2023

Use access_token works, but the conversation won't have a history. A new session will be created on every call.

It will. History is done through conversation_id. All OpenAIAuth does is fetch the access token

how do we get conversation_id or parent_id?

same question, how can i get conversation_id

i got it:

  1. get over to https://chat.openai.com/chat
  2. Tap on a previous conversation, (not the newly created one).
    In the link of the website you'll find the:
    https://chat.openai.com/chat/your_conversation_id

@AkiyaKiko
Copy link

Use access_token works, but the conversation won't have a history. A new session will be created on every call.

It will. History is done through conversation_id. All OpenAIAuth does is fetch the access token

how do we get conversation_id or parent_id?

same question, how can i get conversation_id

i got it:

1. get over to https://chat.openai.com/chat

2. Tap on a previous conversation, (not the newly created one).
   In the link of the website you'll find the:
   https://chat.openai.com/chat/your_conversation_id

got it
but it still can't continue the conversation with the history before, it still start through a new conversation

@jirafey
Copy link

jirafey commented Mar 31, 2023

Use access_token works, but the conversation won't have a history. A new session will be created on every call.

It will. History is done through conversation_id. All OpenAIAuth does is fetch the access token

how do we get conversation_id or parent_id?

same question, how can i get conversation_id

i got it:

1. get over to https://chat.openai.com/chat

2. Tap on a previous conversation, (not the newly created one).
   In the link of the website you'll find the:
   https://chat.openai.com/chat/your_conversation_id

got it but it still can't continue the conversation with the history before, it still start through a new conversation

maybe you need the first parent_id in the chat
endpoint:
"(ip):(port)/api/conversation/(chat_id)"

image

i dont know what im doing but hope somehting like this helps

@logiccao
Copy link

it can still work.

thank you, it works

@AkiyaKiko
Copy link

Use access_token works, but the conversation won't have a history. A new session will be created on every call.

It will. History is done through conversation_id. All OpenAIAuth does is fetch the access token

how do we get conversation_id or parent_id?

same question, how can i get conversation_id

i got it:

1. get over to https://chat.openai.com/chat

2. Tap on a previous conversation, (not the newly created one).
   In the link of the website you'll find the:
   https://chat.openai.com/chat/your_conversation_id

got it but it still can't continue the conversation with the history before, it still start through a new conversation

maybe you need the first parent_id in the chat endpoint: "(ip):(port)/api/conversation/(chat_id)"

image

i dont know what im doing but hope somehting like this helps

OK, i got it. But how can i get the parent_id,? Dose every post get response with different parent_id?

@jirafey
Copy link

jirafey commented Apr 1, 2023

How to use access_token with the proxy though? I dont seem to understand what to do, I see links but I have no idea whats the plan.

@acheong08
Copy link
Owner

@acheong08
Copy link
Owner

Copy the token from the URL to config

@acheong08
Copy link
Owner

@AmarnathCJD
Copy link

https://github.com/AmarnathCJD/ChatGPT/blob/master/auth.go

sus site but accesstoken gen from email/pass working nice 🙂

@AmarnathCJD
Copy link

AmarnathCJD commented Apr 1, 2023

Please just use access tokens. They take 2 weeks to expire

30 days Im getting like 719Hours as expireTime

@acheong08 acheong08 mentioned this issue Apr 2, 2023
1 task
@acheong08 acheong08 self-assigned this Apr 2, 2023
@acheong08 acheong08 added the WIP Work in Progress label Apr 2, 2023
@AmarnathCJD
Copy link

@acheong08 https://github.com/AmarnathCJD/ChatGPT/blob/72e8dc13a082221c41ec3c1c7a871a194095cef1/ask.go#L214

The chat history thing is not working, each message is out of context

Could you please point out what I'm doing wrong here 🫠

@acheong08
Copy link
Owner

@acheong08 AmarnathCJD/ChatGPT@72e8dc1/ask.go#L214

The chat history thing is not working, each message is out of context

Could you please point out what I'm doing wrong here 🫠

Missing conversation id

@RoseLoverX
Copy link

@acheong08 AmarnathCJD/ChatGPT@72e8dc1/ask.go#L214
The chat history thing is not working, each message is out of context
Could you please point out what I'm doing wrong here 🫠

Missing conversation id

got it fixed tnqqq

@acheong08
Copy link
Owner

This issue is stale because it has been open for 2 days with no activity.

@acheong08 acheong08 added the stale label Apr 5, 2023
@MagzhanUnited
Copy link

will it be solved?

@acheong08 acheong08 removed the stale label Apr 8, 2023
@AkiyaKiko
Copy link

Copy the token from the URL to config
the conversation_id doesn't work in config, but it works in parameter of bot.ask(), i don't know why

@acheong08
Copy link
Owner

will it be solved?

Probably not. Mass authentication from a proxy will get accounts banned.

@acheong08
Copy link
Owner

Access tokens now the only way

@HarutaLuna
Copy link

will it be solved?

@MagzhanUnited

you can use access token can be obtained through
https://chat.openai.com/api/auth/session
make sure you have logged in first

@github-actions
Copy link

This issue is stale because it has been open for 2 days with no activity.

@github-actions github-actions bot added the stale label Apr 13, 2023
@github-actions
Copy link

This issue was closed because it has been inactive for 3 days since being marked as stale.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 16, 2023
@hacksman
Copy link

same error

@acheong08
Copy link
Owner

Update your library versions

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
stale WIP Work in Progress
Projects
None yet
Development

No branches or pull requests

16 participants