Skip to content
This repository has been archived by the owner on Aug 3, 2023. It is now read-only.

[Bug]: 'Exception: Authentication failed' with a Status code: 302 #569

Open
1 task done
DrowskoytayhulGuider opened this issue Jun 21, 2023 · 18 comments
Open
1 task done

Comments

@DrowskoytayhulGuider
Copy link

Is there an existing issue for this?

  • I have searched the existing issues and checked the recent builds/commits

What happened?

ran "python -m EdgeGPT.EdgeGPT --cookie-file ./cookies.json" and got the Exception:
EdgeGPT - A demo of reverse engineering the Bing GPT chatbot
Repo: github.com/acheong08/EdgeGPT
By: Antonio Cheong

    !help for help

    Type !exit to exit

Initializing...
Enter alt+enter or escape+enter to send a message
Status code: 302

<title>Object moved</title>

Object moved to here.

https://edgeservices.bing.com/edgesvc/turing/conversation/create
Traceback (most recent call last):
File "D:\program files (x86)\python\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "D:\program files (x86)\python\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "D:\program files (x86)\python\lib\site-packages\EdgeGPT\EdgeGPT.py", line 218, in
main()
File "D:\program files (x86)\python\lib\site-packages\EdgeGPT\main.py", line 244, in main
asyncio.run(async_main(args))
File "D:\program files (x86)\python\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "D:\program files (x86)\python\lib\asyncio\base_events.py", line 642, in run_until_complete
return future.result()
File "D:\program files (x86)\python\lib\site-packages\EdgeGPT\main.py", line 79, in async_main
bot = await Chatbot.create(proxy=args.proxy, cookies=cookies)
File "D:\program files (x86)\python\lib\site-packages\EdgeGPT\EdgeGPT.py", line 42, in create
await Conversation.create(self.proxy, cookies=cookies),
File "D:\program files (x86)\python\lib\site-packages\EdgeGPT\conversation.py", line 111, in create
raise Exception("Authentication failed")
Exception: Authentication failed

Steps to reproduce the problem

  1. run "pip install EdgeGPT==0.11.4" to get EdgeGPT and get the cookie following the method as you said.
  2. write "python -m EdgeGPT.EdgeGPT --cookie-file ./cookies.json" in cmd.
  3. press enter.
  4. go wrong.

What should have happened?

Chat with new Bing normally.

Version where the problem happens

EdgeGPT 0.11.4

What Python version are you running this with?

python 3.9.0

What is your operating system ?

Windows

Command Line Arguments

Console logs

EdgeGPT - A demo of reverse engineering the Bing GPT chatbot
        Repo: github.com/acheong08/EdgeGPT
        By: Antonio Cheong

        !help for help

        Type !exit to exit

Initializing...
Enter `alt+enter` or `escape+enter` to send a message
Status code: 302
<html><head><title>Object moved</title></head><body>
<h2>Object moved to <a href="https://cn.bing.com/edgesvc/turing/conversation/create">here</a>.</h2>
</body></html>

https://edgeservices.bing.com/edgesvc/turing/conversation/create
Traceback (most recent call last):
  File "D:\program files (x86)\python\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "D:\program files (x86)\python\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "D:\program files (x86)\python\lib\site-packages\EdgeGPT\EdgeGPT.py", line 218, in <module>
    main()
  File "D:\program files (x86)\python\lib\site-packages\EdgeGPT\main.py", line 244, in main
    asyncio.run(async_main(args))
  File "D:\program files (x86)\python\lib\asyncio\runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "D:\program files (x86)\python\lib\asyncio\base_events.py", line 642, in run_until_complete
    return future.result()
  File "D:\program files (x86)\python\lib\site-packages\EdgeGPT\main.py", line 79, in async_main
    bot = await Chatbot.create(proxy=args.proxy, cookies=cookies)
  File "D:\program files (x86)\python\lib\site-packages\EdgeGPT\EdgeGPT.py", line 42, in create
    await Conversation.create(self.proxy, cookies=cookies),
  File "D:\program files (x86)\python\lib\site-packages\EdgeGPT\conversation.py", line 111, in create
    raise Exception("Authentication failed")
Exception: Authentication failed

Additional information

No response

@acheong08
Copy link
Owner

If that doesn't work, do export BING_PROXY_URL="https://cn.bing.com/edgesvc/turing/conversation/create"

@DrowskoytayhulGuider
Copy link
Author

DrowskoytayhulGuider commented Jun 22, 2023

If that doesn't work, do export BING_PROXY_URL="https://cn.bing.com/edgesvc/turing/conversation/create"

I have set it as an environment variable. I got another status code:301. The same exception still exists.

@acheong08 acheong08 reopened this Jun 22, 2023
@acheong08
Copy link
Owner

Where does it redirect to?

@Nu11Const
Copy link
Contributor

Hey,@acheong08,https://cn.bing.com/edgesvc/turing/conversation/create is doesn't work.If you can make a proxy for EdgeGPT,BingImageCreator?

@Nu11Const
Copy link
Contributor

Fix then:

     EdgeGPT - A demo of reverse engineering the Bing GPT chatbot
        Repo: github.com/acheong08/EdgeGPT
        By: Antonio Cheong

        !help for help

        Type !exit to exit

Initializing...
Enter `alt+enter` or `escape+enter` to send a message
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/EdgeGPT/EdgeGPT.py", line 218, in <module>
    main()
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/EdgeGPT/main.py", line 244, in main
    asyncio.run(async_main(args))
  File "/data/data/com.termux/files/usr/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/EdgeGPT/main.py", line 79, in async_main
    bot = await Chatbot.create(proxy=args.proxy, cookies=cookies)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/EdgeGPT/EdgeGPT.py", line 42, in create
    await Conversation.create(self.proxy, cookies=cookies),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/EdgeGPT/conversation.py", line 103, in create
    response = await client.get(
               ^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/httpx/_client.py", line 1757, in get
    return await self.request(
           ^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/httpx/_client.py", line 1530, in request
    return await self.send(request, auth=auth, follow_redirects=follow_redirects)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/httpx/_client.py", line 1617, in send
    response = await self._send_handling_auth(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/httpx/_client.py", line 1645, in _send_handling_auth
    response = await self._send_handling_redirects(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/httpx/_client.py", line 1675, in _send_handling_redirects
    raise TooManyRedirects(
httpx.TooManyRedirects: Exceeded maximum allowed redirects.

@acheong08
Copy link
Owner

Looks like a recursive redirect. Could it be because of the IP spoofing?

@Nu11Const
Copy link
Contributor

Make a public proxy without cloudflare CDN,Try another CDN.

@acheong08
Copy link
Owner

Which CDN is free and accessible for China? I tried gcore before but it didn't work

@Nu11Const
Copy link
Contributor

Make a full reverse proxy https://www.bing.com

@acheong08
Copy link
Owner

btw 9b32a32 might help with the redirect.

@acheong08
Copy link
Owner

Make a full reverse proxy https://www.bing.com

not edgeservices?

@Nu11Const
Copy link
Contributor

Nu11Const commented Jun 22, 2023

Which CDN is free and accessible for China? I tried gcore before but it didn't work

Do you know the Chinese CDN services?
What about the Aliyun or the Tencent cloud?
But it not free.

@Nu11Const
Copy link
Contributor

Make a full reverse proxy https://www.bing.com

not edgeservices?

Yes,not edgeservices,It can be use in EdgeGPT and the BingImageCreator.

acheong08 pushed a commit that referenced this issue Jun 22, 2023
@Nu11Const
Copy link
Contributor

BingImageCreator need a full site proxy

@acheong08
Copy link
Owner

acheong08 commented Jun 22, 2023

Can China access repl.it, vercel, or cloudflare workers? I ran out of credit for my US server recently

@Nu11Const
Copy link
Contributor

Can China access repl.it, vercel, or cloudflare workers? I ran out of credit for my US server recently

repl.it can work,vercel.app domain can't access,but with a custom domain can work.worker.dev domain can't access,but with a custom domain can work.

@DrowskoytayhulGuider
Copy link
Author

Hey, is there any good solution for "httpx.TooManyRedirects: Exceeded maximum allowed redirects."? I aways meet this problem.

@DrowskoytayhulGuider
Copy link
Author

Snipaste_2023-07-09_20-41-20

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

No branches or pull requests

3 participants