{"record":{"id":"f5c983b87333487c","repo":"binary-husky/gpt_academic","slug":"authentication-failed","errorCode":null,"errorMessage":"Authentication failed","messagePattern":"Authentication failed","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"request_llms/edge_gpt_free.py","lineNumber":341,"sourceCode":"            headers=HEADERS_INIT_CONVER,\n        )\n        if cookies:\n            for cookie in cookies:\n                self.session.cookies.set(cookie[\"name\"], cookie[\"value\"])\n        # Send GET request\n        response = self.session.get(\n            url=os.environ.get(\"BING_PROXY_URL\")\n            or \"https://edgeservices.bing.com/edgesvc/turing/conversation/create\",\n        )\n        if response.status_code != 200:\n            response = self.session.get(\n                \"https://edge.churchless.tech/edgesvc/turing/conversation/create\",\n            )\n        if response.status_code != 200:\n            print(f\"Status code: {response.status_code}\")\n            print(response.text)\n            print(response.url)\n            raise Exception(\"Authentication failed\")\n        try:\n            self.struct = response.json()\n        except (json.decoder.JSONDecodeError, NotAllowedToAccess) as exc:\n            raise Exception(\n                \"Authentication failed. You have not been accepted into the beta.\",\n            ) from exc\n        if self.struct[\"result\"][\"value\"] == \"UnauthorizedRequest\":\n            raise NotAllowedToAccess(self.struct[\"result\"][\"message\"])\n\n    @staticmethod\n    async def create(\n        proxy=None,\n        cookies=None,\n    ):\n        self = _Conversation(async_mode=True)\n        self.struct = {\n            \"conversationId\": None,\n            \"clientId\": None,","sourceCodeStart":323,"sourceCodeEnd":359,"githubUrl":"https://github.com/binary-husky/gpt_academic/blob/d6bde0fa54373309bd05823a49bda8da019d2c77/request_llms/edge_gpt_free.py#L323-L359","documentation":"Synchronous (requests-based) Bing/Copilot conversation creation failed: after trying the configured BING_PROXY_URL (default https://edgeservices.bing.com/edgesvc/turing/conversation/create) and the fallback proxy edge.churchless.tech, the HTTP status was still not 200, so edge_gpt_free raises Exception('Authentication failed'). The printed status code/body/url above the raise identify the actual response.","triggerScenarios":"_Conversation.__init__ path in request_llms/edge_gpt_free.py:341: both conversation/create GETs return non-200. Typical when Bing rejects the client cookies (missing/invalid edge cookies), the beta is not enabled for the account, an IP is blocked (429/403), or the churchless fallback proxy is down.","commonSituations":"Using the free newbing/edge_gpt_free bridge without valid Bing cookies; region/IP blocked by edgeservices.bing.com; both endpoints rate-limited; BING_PROXY_URL pointing at a dead self-hosted proxy.","solutions":["Check the printed status code and response body — 401/403 means cookies/beta, 429 means rate limit or IP block","Provide fresh valid Bing cookies to the conversation client (the newbing bridge passes cookies; stale cookies are the #1 cause)","If self-hosting BING_PROXY_URL, verify that proxy is alive and forwards cookies correctly; otherwise clear the env var to use the default + fallback","Switch to a supported model/bridge (this free endpoint is inherently unreliable) or retry later when the fallback proxy recovers"],"exampleFix":"# before\nos.environ.pop('BING_PROXY_URL', None)  # both bing + churchless return non-200\n\n# after: supply valid cookies via the newbing bridge config\n# config_private.py\nNEWBING_COOKIES = '...fresh _U cookie from edge browser...'","handlingStrategy":"retry","validationCode":"import requests\nfor url in (os.environ.get('BING_PROXY_URL') or 'https://edgeservices.bing.com/edgesvc/turing/conversation/create',\n            'https://edge.churchless.tech/edgesvc/turing/conversation/create'):\n    r = requests.get(url, timeout=10)\n    print(url, r.status_code)  # both must be 200 for the free bridge to work","typeGuard":null,"tryCatchPattern":"for attempt in range(2):\n    try:\n        convo = _Conversation(sync_mode=True, cookies=cookies)\n        break\n    except Exception as e:\n        if 'Authentication failed' in str(e) and attempt == 0:\n            cookies = refresh_bing_cookies()\n            continue\n        raise","preventionTips":["Harvest complete fresh Bing cookies before each long session","Keep BING_PROXY_URL pointed at a proxy you control and monitor","Treat this free endpoint as best-effort: wrap calls with retry and a fallback model"],"tags":["bing","authentication","network","third-party-api","free-tier"],"backgroundTag":null,"analyzedSha":"d6bde0fa54373309bd05823a49bda8da019d2c77","analyzedAt":"2026-08-14T22:48:35.038Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}