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

Access denied to ChatGPT #9

Open
maxmeyer opened this issue Apr 23, 2023 · 2 comments
Open

Access denied to ChatGPT #9

maxmeyer opened this issue Apr 23, 2023 · 2 comments

Comments

@maxmeyer
Copy link

Is there anything I can do about it? I configured all cookies as described in the README. Looks like Cloudflare is blocking me.

2023/04/23 11:48:11 http response info: 
HTTP/2.0 403 Forbidden
Alt-Svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400
Cache-Control: private, max-age=0, no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Cf-Mitigated: challenge
Cf-Ray: 7bc5307aed96cb11-DUS
Content-Type: text/html; charset=UTF-8
Cross-Origin-Embedder-Policy: require-corp
Cross-Origin-Opener-Policy: same-origin
Cross-Origin-Resource-Policy: same-origin
Date: Sun, 23 Apr 2023 09:48:11 GMT
Expires: Thu, 01 Jan 1970 00:00:01 GMT
Permissions-Policy: accelerometer=(),autoplay=(),camera=(),clipboard-read=(),clipboard-write=(),fullscreen=(),geolocation=(),gyroscope=(),hid=(),interest-cohort=(),magnetometer=(),microphone=(),payment=(),publickey-credentials-get=(),screen-wake-lock=(),serial=(),sync-xhr=(),usb=()
Referrer-Policy: same-origin
Server: cloudflare
Set-Cookie: __cf_bm=XXXXXXX; path=/; expires=Sun, 23-Apr-23 10:18:11 GMT; domain=.chat.openai.com; HttpOnly; Secure; SameSite=None
Vary: Accept-Encoding
X-Frame-Options: SAMEORIGIN
X-Robots-Tag: nofollow


2023/04/23 11:48:11 http response info: <html>
  <head>
    <style global>body{font-family:Arial,Helvetica,sans-serif}.container{align-items:center;display:flex;flex-direction:column;gap:2rem;height:100%;justify-content:center;width:100%}@keyframes enlarge-appear{0%{opacity:0;transform:scale(75%) rotate(-90deg)}to{opacity:1;transform:scale(100%) rotate(0deg)}}.logo{color:#8e8ea0}.scale-appear{animation:enlarge-appear .4s ease-out}@media (min-width:768px){.scale-appear{height:48px;width:48px}}.data:empty{display:none}.data{border-radius:5px;color:#8e8ea0;text-align:center}@media (prefers-color-scheme:dark){body{background-color:#343541}.logo{color:#acacbe}}</style>
  
</head>
....
      <div class="data"><form id="challenge-form" class="challenge-form" action="/api/auth/session?__cf_chl_f_tk=2qQUwEBfpgXHMEERbqIHxaQ45cLMnMjZX9tpDHYDf.M-1682243291-0-gaNycGzNFuU" method="POST" enctype="application/x-www-form-urlencoded">
    <div id="cf-please-wait">
        <div id="spinner">
            <div id="cf-bubbles">
                <div class="bubbles"></div>
                <div class="bubbles"></div>
                <div class="bubbles"></div>
            </div>
        </div>
        <p id="cf-spinner-please-wait">Please stand by, while we are checking your browser...</p>
        <p id="cf-spinner-redirecting" style="display:none">Redirecting...</p>
    </div>
....
2023/04/23 11:48:11 get chat text failed: send message failed: get accessToken failed: invalid session data: 
@wawagit
Copy link

wawagit commented Apr 25, 2023

same issue for me

get chat text failed: send message failed: get accessToken failed: fetch new accessToken failed: parse response body failed

Looks like there is now a Cloudflare protection to limit or stop chatgpt bot:

When calling /api/auth/session endpoint there is a cloudflare challenge page designed to determine whether the request was sent by a human or a robot.

@wawagit
Copy link

wawagit commented Apr 25, 2023

works for me when setting this user agent:

cli := chatgpt.NewClient( chatgpt.WithTimeout(620*time.Second), chatgpt.WithCookies(cookies), chatgpt.WithModel("gpt-4-32k"), // UserAgent chatgpt.WithUserAgent("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36"), )

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

2 participants