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

Im getting error 403 Fobidden #16

Closed
DrMemoryFish opened this issue Dec 12, 2022 · 22 comments
Closed

Im getting error 403 Fobidden #16

DrMemoryFish opened this issue Dec 12, 2022 · 22 comments

Comments

@DrMemoryFish
Copy link

Error loading webview: Error: Could not register service workers: InvalidStateError: Failed to register a ServiceWorker: The document is in an invalid state.

An error occurred. If the issue persists try 'ChatGPT: Clear session.'

I get the above error codes. I've refreshed and cleared many times.

@gregid
Copy link

gregid commented Dec 12, 2022

I started getting 403 Forbidden yesterday evening - I wondered if anyone else is having similar problem. I assumed OpenAI may have throtthled access from outside of their web ui.
I didn't have ServiceWorker error though (just 403).

@xichen-de
Copy link

I also started getting 403 Forbidden today. The problem persists even after deleting the session. Looks like OpenAI is restricting access.

@Joey0x646576
Copy link

Joey0x646576 commented Dec 12, 2022

According to the creator of chatgpt-api they added additional cloudflare protection.

To bypass this you need two additional properties; cf_clearance and user-agent. While this works, it's only available for a limited time, before you need to refresh your cf_clearance token.

This package is not updated with the latest chatgpt-api, but if you update the dependencies and build it yourself it will still function.

@gencay
Copy link
Owner

gencay commented Dec 12, 2022

Hi - yes, there have been multiple changes on the openai side. I am working on a resolution

@gencay
Copy link
Owner

gencay commented Dec 12, 2022

Update: ChatGPT servers are completely down right now that blocks development progress. I will update again if/when I find a resolution for our extension. Thanks all for the patience!

@gencay
Copy link
Owner

gencay commented Dec 12, 2022

Update: Hang tight, the VSCode marketplace package seems to not include puppeteer built-in chromium. Thus there are run-time errors in the extension. WIP

Hi everybody,

I've a fix for the recent 403 issue and it's being rolled out right now. Please watch out the version 1.7.1 on marketplace 🎉

The new workflow logs you in automatically without needing to copy paste the cookies onto the extension:

  • Enter your email address
  • Enter your password (We don't store anything, all personal information remains locally on your vs-code)

Let the login flow automatically run:

  • It'll open a new chrome instance and use the credentials you provided to automatically login and grab the required fields from your cookie.

Since OpenAI servers are experiencing issues, please expect intermittent login failures / outage messages on openai website during auto-login flow.

This is the first attempt to overcome the 403 errors. Let me know if you face issues. I will keep the Issue open until we are good with the current solution.

@raifpy
Copy link

raifpy commented Dec 12, 2022

What about OAuth?

@gencay
Copy link
Owner

gencay commented Dec 12, 2022

Mitigation in place: Add your session cookies and userAgent manually. You can grab these from session cookies cf_clearance and __Secure-next-auth.session-token + run this in console to get your User Agent: navigator.userAgent.

I'm working on an auto-login flow which I mentioned in my earlier message. This will be much neater than refreshing those cookies manually. The v1.7.2 now works when you provide session-token, cf_clearance and userAgent variables.
image

@gregid
Copy link

gregid commented Dec 12, 2022

Run the following command in Console to find your user agent: navigator.userAgent. Enter the content of this value when prompted by the extension.

I would change it to:

Run the following command in (web browser) Console to find your user agent: navigator.userAgent. Enter the content of this value when prompted by the extension (no single or double quotes).
  • The first part (console) got me confused for a moment :)
  • The quotes - only second time after I avoided quotes in copying and pasting it worked - not sure if just a fluke or one should exclude these quotes.

@GitHdu
Copy link

GitHdu commented Dec 14, 2022

Update: Hang tight, the VSCode marketplace package seems to not include puppeteer built-in chromium. Thus there are run-time errors in the extension. WIP

Hi everybody,

I've a fix for the recent 403 issue and it's being rolled out right now. Please watch out the version 1.7.1 on marketplace 🎉

The new workflow logs you in automatically without needing to copy paste the cookies onto the extension:

  • Enter your email address
  • Enter your password (We don't store anything, all personal information remains locally on your vs-code)

Let the login flow automatically run:

  • It'll open a new chrome instance and use the credentials you provided to automatically login and grab the required fields from your cookie.

Since OpenAI servers are experiencing issues, please expect intermittent login failures / outage messages on openai website during auto-login flow.

This is the first attempt to overcome the 403 errors. Let me know if you face issues. I will keep the Issue open until we are good with the current solution.

still getting 403 forbidden

@curtisreynolds57
Copy link

Update: Hang tight, the VSCode marketplace package seems to not include puppeteer built-in chromium. Thus there are run-time errors in the extension. WIP
Hi everybody,
I've a fix for the recent 403 issue and it's being rolled out right now. Please watch out the version 1.7.1 on marketplace 🎉
The new workflow logs you in automatically without needing to copy paste the cookies onto the extension:

  • Enter your email address
  • Enter your password (We don't store anything, all personal information remains locally on your vs-code)

Let the login flow automatically run:

  • It'll open a new chrome instance and use the credentials you provided to automatically login and grab the required fields from your cookie.

Since OpenAI servers are experiencing issues, please expect intermittent login failures / outage messages on openai website during auto-login flow.
This is the first attempt to overcome the 403 errors. Let me know if you face issues. I will keep the Issue open until we are good with the current solution.

still getting 403 forbidden

I believe he hasn't released the fix, yet.

@gencay
Copy link
Owner

gencay commented Dec 14, 2022

I did release the fix and the new flow that requires session token, clearance token and user agent. Check the Readme.md for getting those.

@gencay
Copy link
Owner

gencay commented Dec 14, 2022

The issues seem to be happening for some users of the downstream API wrapper we are using. There is an active discussion here: transitive-bullshit/agentic#96 (comment). Some people reported that getting the required tokens and user-agent using a different browser than Chrome helped them bypass the 403 issues.

@Noppey
Copy link

Noppey commented Dec 14, 2022

Still 403 unfortunately.
None of the restrictions that are mentioned in that comment are applicable.

Tried with Edge:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36 Edg/108.0.1462.46

Tried with Chrome and Brave:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36

Tried with node 18 and 19. No proxy, no other fancy stuff.

@gencay
Copy link
Owner

gencay commented Dec 14, 2022

Hello everybody,

I released a new version that supports automated authentication 🚀

Check out the release notes and the Readme on how to enable this setting.
image

This is still an experimental setting, thus not a default. If y'all could try out the new feature it'd be great!

Once I get enough confirmation, I will make this the default way to use the extension.

@curtisreynolds57
Copy link

Hello everybody,

I released a new version that supports automated authentication 🚀

Check out the release notes and the Readme on how to enable this setting. image

This is still an experimental setting, thus not a default. If y'all could try out the new feature it'd be great!

Once I get enough confirmation, I will make this the default way to use the extension.

The servers are down right now, but I was testing this out earlier. It said something along the lines of "there's no field for #username." I'll see if I can replicate it when the servers go back up, but it seems puppeteer doesn't know how to input the username

@gencay
Copy link
Owner

gencay commented Dec 14, 2022

Yes, servers are occasionally down today.

I am working on a zero-config setup. The extension will open chrome and will let you login as usual. Once login flow is complete, the extension will then grab the tokens automatically for you and close the chrome.

This way you won't need to provide any usernanme, password nor chrome path(it will pick up from default chrome installation path, with an option to override).

Zero config on the way!

@curtisreynolds57
Copy link

I see that. I'm still getting 403 forbidden, even from the auto login. I have looked at all of the requirements, such as updating Node js, not opening the client while trying to connect, etc.

@gencay
Copy link
Owner

gencay commented Dec 14, 2022

The Zero-Config setup is rolled out with v1.8.3. On this version you have the option to have automatic authentication using puppeteer. If you haven't used it yet, Clear your session and run a prompt; it will automatically open Chrome and you should login as usual. Once you land on chat page, the browser will be automatically closed and you will be authenticated using the tokens off of that session.

Though there are still 403 issues with OpenAI APIs since they throttle programmatic access.

@curtisreynolds57
Copy link

Yeah, even with the manual login, it's still giving me 403 forbidden.

@Noppey
Copy link

Noppey commented Dec 15, 2022

Is it possible to provide some logging output of the OpenAI Api when getting the 403? This way we can provide this logging to transitive-bullshit github as well, as that's probably where this has to be solved.

@gencay
Copy link
Owner

gencay commented Dec 26, 2022

I've been away on vacation for a few weeks, and I updated the extension to utilize the browser for ChatGPT queries. Make sure to keep the Chrome browser open after successful login (previously it was closing automatically causing 429 for subsequent questions). Whenever you restart your vs-code or close the Chrome instance please make sure to log-in again to keep an active ChatGPT connection. The extension will use the browser behind the scenes for your queries.

Since v2 will resolve this issue, I am closing it. Please update to latest on marketplace. Thanks for all the engagement and patience.

fyi @Noppey @gregid @Joey0x646576 @GitHdu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants