Closed hongyi-zhao closed 1 year ago
There used to be a way but it has since been broken by OpenAI. Requires PUID
What's the meaning of PUID
?
Plus user ID. Found in cookies
If there are any scriptable or command line based methods to do this job? I've tried as follows but got nothing:
werner@X10DAi:~$ curl -fsSLx socks5h://127.0.0.1:18890 https://chat.openai.com/api/auth/session |grep -i accesstoken
curl: (22) The requested URL returned error: 403
if it is possiable to use Python to simulate a browser and submit an account and password to "openai.com" through a proxy, and then use requests to obtain token from "https://chat.openai.com/api/auth/session"?
import requests
target_url = 'https://chat.openai.com/api/auth/session'
session = requests.Session() session.proxies = {'https': 'socks5://192.168.0.101:20171','http': 'socks5://192.168.0.101:20171'}
login_data = { 'username': 'openai account', 'password': 'passwd' }
login_response = session.post('https://openai.com/login', data=login_data)
if login_response.status_code == 200: response = session.get(target_url)
print(response.text)
else: print('Login failed.')
I tried.But goes wrong.Don't konw why.
Thank you very much.
We are currently already capable of this: in config:
{
"email": "email",
"password": "your password"
}
It will fetch token via that library
Great. I found it in src.It will get new token automaticly when it's expired. Thanks again.
I would like to know how to integrate the method mentioned above into other tools, such as gpt_academic, to bypass the OpenAI API expiration problem discussed here.
@prairiewolf11
I found it in src.It will get new token automaticly when it's expired.
Where is the corresponding source code?
\Lib\site-packages\revChatGPT\V1.py
I mean, what are the exact source code lines in V1.py.
If error email & password is available and cached access token fails (which also checks for expiry)
Login is in check credentials:
@acheong08
https://github.com/acheong08/ChatGPT/issues/1314#issuecomment-1615868449 https://github.com/acheong08/OpenAIAuth
https://github.com/acheong08/ChatGPT/issues/1314#issuecomment-1615871117 It will fetch token via that library
Thank you very much for pointing out the corresponding implementation. But I still cannot see the calling of OpenAIAuth
package in these code snippets. Any more hints?
auth = Authenticator(
email=self.config.get("email"),
password=self.config.get("password"),
proxy=self.config.get("proxy"),
)
self.set_access_token(auth.get_access_token())
Got it. Another related line:
So, all the above code snippets are corresponding to the usage mentioned here.
When using V1 for querying, the following error occurred
So, is it possible to retrieve the authentication token and update the config file automatically?