chatgpt-telegram icon indicating copy to clipboard operation
chatgpt-telegram copied to clipboard

Some Suggestion about "without session token"

Open EricMeteorite opened this issue 2 years ago • 13 comments

A small suggestion is that maybe this program can use OpenAI's user email and password as a config file, and also maybe can try to let the program "Automatically grab Session Token", so that it can be used without a session token and without popping up a browser window? Is that OK to be achieved?

And, thank you so much for your contribution!

EricMeteorite avatar Dec 06 '22 17:12 EricMeteorite

Also, It would be great if you could add a Terminal-like function to the program. We don’t need to restart the program through the server or host every time. We can restart the program at any time by calling Terminal to restart through telegram.

EricMeteorite avatar Dec 07 '22 05:12 EricMeteorite

@EricMeteorite OpenAI's email/password authentication system is pretty complex and changes quite often. I've got a solution in Python but its very difficult to maintain.

acheong08 avatar Dec 07 '22 05:12 acheong08

It has a total of 8 different parts to it and occasional captcha which also needs to be handled

acheong08 avatar Dec 07 '22 05:12 acheong08

@acheong08 Got it, thanks, it is really not very convenient to realize this function.

EricMeteorite avatar Dec 07 '22 05:12 EricMeteorite

If anyone needs some reference code, https://github.com/acheong08/OpenAIAuth currently works. I hope this feature gets added to the bot

GitHub
OpenAI Authentication Library for ChatGPT. Contribute to acheong08/OpenAIAuth development by creating an account on GitHub.

acheong08 avatar Dec 08 '22 03:12 acheong08

If anyone needs some reference code, https://github.com/acheong08/OpenAIAuth currently works. I hope this feature gets added to the bot

GitHub**GitHub - acheong08/OpenAIAuth: OpenAI Authentication Library for ChatGPT**OpenAI Authentication Library for ChatGPT. Contribute to acheong08/OpenAIAuth development by creating an account on GitHub.

I'll work on a golang version of that, should be done by tomorrow.

GitHub
OpenAI Authentication Library for ChatGPT. Contribute to acheong08/OpenAIAuth development by creating an account on GitHub.

rodjunger avatar Dec 08 '22 22:12 rodjunger

Thank you @rodjunger

acheong08 avatar Dec 09 '22 00:12 acheong08

Thank you @rodjunger

No problem! Just hit the first milestone, got a full login working with only requests in go (including saving the captcha to a png and sending the response in the request), I will clean things up a bit and upload it to a repository in the next hour (or after brazils game in the world cup).

There's plenty of error checking in the code but basically no logging, just some debug prints. It shouldn't take a lot of time to add that tho.

rodjunger avatar Dec 09 '22 14:12 rodjunger

got a full login working with only requests in go

How did you bypass their client fingerprinting?

acheong08 avatar Dec 09 '22 14:12 acheong08

I'm having trouble porting it to pure requests in Python

acheong08 avatar Dec 09 '22 14:12 acheong08

got a full login working with only requests in go

How did you bypass their client fingerprinting?

In Golang it's easier to spoof TLS and http2 fingerprints since everything is implemented in go (no openssl or external libs), I used a library called mimic which creates a patched roundTripper that mimics chrome. I also made a small script on python to convert headers from charles proxy to go so I could have the exact same headers as the browser in the same order in case they fingerprinted that too.

With that said, it's probably not possible to get it working with pure requests if they're actually fingerprinting all of that.

rodjunger avatar Dec 09 '22 15:12 rodjunger

With that said, it's probably not possible to get it working with pure requests if they're actually fingerprinting all of that.

Got it. It does seem they're doing that for Auth0.

acheong08 avatar Dec 09 '22 15:12 acheong08

WIP version uploaded to github:

https://github.com/rodjunger/chatgptauth

GitHub
GoLang library to authenticate with the ChatGPT service through api interactions - GitHub - rodjunger/chatgptauth: GoLang library to authenticate with the ChatGPT service through api interactions

rodjunger avatar Dec 09 '22 18:12 rodjunger