timkmecl / chatgpt-vscode

VSCode extension that allows you to use ChatGPT or GPT4 inside the IDE
331 stars 81 forks source link

[ERROR] Error: ChatGPT failed to refresh auth token. Error: 403 Forbidden #4

Closed 9amcoder closed 1 year ago

9amcoder commented 1 year ago

After copy and paste the Clearance Token, Session Token and User Agent. I got 403 error.

Screenshot 2022-12-13 at 12 47 02 PM
timkmecl commented 1 year ago

This is currently an issue for some users (see this discussion for more) caused by some for now unidentified problem in the way chatgpt-api communicates with server that will hopefully soon be solved. Therefore if you exactly followed the instructions from README, there is unfortunately nothing I can do for now, I will notify you once the solution is found and implemented.

For now, could you please tell me the operating system, browser and exact user-agent you are using? This may help us find something.

If anyone knows what is going on (here and in the thread linked), please let me know and I will fix it ASAP.

delicacyyy commented 1 year ago

This is currently an issue for some users (see this discussion for more) caused by some for now unidentified problem in the way chatgpt-api communicates with server that will hopefully soon be solved. Therefore if you exactly followed the instructions from README, there is unfortunately nothing I can do for now, I will notify you once the solution is found and implemented.

For now, could you please tell me the operating system, browser and exact user-agent you are using? This may help us find something.

If anyone knows what is going on (here and in the thread linked), please let me know and I will fix it ASAP.

Please tell me how to get vsix file after yarn package

timkmecl commented 1 year ago

It looks like this problem is not limited to this project, but also to some other ones using chatgpt-api, probably caused by agressive CloudFlare protection. In my own testing, even when I tried to login to my account in Chrome right after using it inside Edge, I got a 403 error inside the web version. After I waited for several minutes and tried again, it disappeard, but this shows that the problem is not just with the javascript API.

The browser that you use for getting the tokens might influence the chance to get 403, especially chrome, so maybe try from another one (https://github.com/transitive-bullshit/chatgpt-api/issues/107#issuecomment-1349712906)

There might also be some account or IP flagging going on either by OpenAI or CloudFlare that increases the possibility of getting 403 especially if doing lots of requests often (https://github.com/transitive-bullshit/chatgpt-api/issues/96#issuecomment-1350275343)

I am currently working on upgrading the login method for the extension to include an option to login using email and password, which will hopefully help solve this, will update you all then. In the meantime, if anyone learns something new about this, feel free to post it here!

Update:

It seems like using Chrome to obtain the tokens is what is causing (most of?) these issues (see this, this). So if you have 403 Error despite following the instructions, try using a browser other than Chrome!

I will update the README to include this info.

eshack94 commented 1 year ago

Same issue here.

ibiscp commented 1 year ago

Same error using Firefox and Brave

brzka commented 1 year ago

Can confirm that the 403 error is coming up with Firefox.

TimPickup commented 1 year ago

Same using other browsers

timkmecl commented 1 year ago

Hi, thank you all for sharing the issue. It seems that OpenAI's Clodflare protection has become more agressive, so the extension may no longer work for some users (only return 403/429 errors). There is unfortunately nothing I can do for the moment, but I will update it when/if there is a solution.

mohammad-oghli commented 1 year ago

Check this thread from this link for the only workaround for the issue.

timkmecl commented 1 year ago

This should now be solved in the latest version, download it from Marketplace

New version uses a method described in this tweet (simple Node.js implementation here), already implemented in the unofficial chatgpt api. Only the official API key from OpenAI needed.

radiowave21 commented 1 year ago

Encountered the same issue with v1.1.10, using MS Edge.