Closed inuru closed 1 year ago
+1
+1
+1
+1
+1
If you check authentication session token. It changed every second in the cookies tab. I think there is change in the backend code from the ChatGPT application side.
refrenced issue: https://github.com/transitive-bullshit/chatgpt-api/issues/96
Added a capture for cf_clearance token in latest release.
still getting the same error
Me too. Followed the instructions in README, reset the token, pasted both tokens and still get 403: Forbidden.
I'm not familiar with Typescript, but I think you need to fix it below.
this.sessionToken = userSessionToken!;
this.context.globalState.update('chatgpt-clearance-token', this.sessionToken);
↓
this.clearanceToken = userSessionToken!;
this.context.globalState.update('chatgpt-clearance-token', this.clearanceToken);
Also he should add userAgent
as mentioned in the updated issue on chatgpt-api.
Your user-agent and IP address must match from the real browser window you're logged in with to the one you're using for ChatGPTAPI
My pull request #24 implements solutions by @mohammad-oghli and @ImYuya, should completely solve the issue caused by CloudFlare.
still getting the same error...
I input sessionToken
, clearanceToken
and userAgent
.
Same thing. Still same error
+1 same issue.
v1.1.8 still got the same error
Sorry, I've forgotten to commit changes that actually pass userAgent
to ChatGPTAPI
in the previous PR, #25 should fix this (I tested it and it works for me).
Not working for me.
the ChatGPTAPI update to 2.3.0, which require OpenAIEmail and OpenAIPassword to ensureAuth. BUT! it require nodejs >=18 which vscode bundle 16.14.3. No solution...
I just retested it and it still works for me. Maybe nodejs version is the problem like @oldcodeoberyn says; could someone with the problem post their node version (node -v
in terminal) to check it? I have v18.12.1
.
@mohammad-oghli Are you using it on the same machine and obtaining tokens in the same way as you did here? The implemented fix is basically the same as I did in my extension.
I just retested it and it still works for me. Maybe nodejs version is the problem like @oldcodeoberyn says; could someone with the problem post their node version (
node -v
in terminal) to check it? I havev18.12.1
.@mohammad-oghli Are you using it on the same machine and obtaining tokens in the same way as you did here? The implemented fix is basically the same as I did in my extension.
updated nodejs, still the 403 error
I will paste my answer from my extension here which shows some new info about this:
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)
It seems like using Chrome to obtain the tokens is what is causing (most of?) these issues. So if you have 403 Error despite following the instructions and using code from #25 PR, try using a browser other than Chrome!
It was not working with Chrome but it's ok using Edge (Win11) 👍🏻
I have tried in Chrome, Firefox, Edge, and Brave. They all lead to this error.
However, I haven't done JS development for a bit. My node version is v14.16.1
. Going to try updating that and trying again.
I updated to node v18.12.1
and am still encountering the same issue. Used the Brave browser.
E.g. useragent key-value pair:
user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36
I have the token but always Got error 403. Is there step that I miss?