BingChat icon indicating copy to clipboard operation
BingChat copied to clipboard

UnauthorizedRequest

Open hswlab opened this issue 9 months ago • 8 comments

Is someone else getting this Error?

UnauthorizedRequest

"The conversationSignature is not set and is required to ensure that you have permission to use our APIs. IsAuthenticated=False. App ID="

Edit: If I comparing the current payload on Bing, it seems that "ConversationSignature" is not send in the payload anymore and it is also missing in the new conversation response. I removed the attribute from the payload, but still get this error. So, the create call still works, only when creating the websocket connection there are problems. I can't figure out why this doesn't work with the modified payload. Is anyone here more familiar with websockets?

hswlab avatar Oct 05 '23 17:10 hswlab

I finally figured it out. Bing no longer sends the signature in the response content, but in the response header inside X-Sydney-EncryptedConversationSignature. I now use my own solution to communicate with Bing, but the communication principle is more or less the same as with the Bing API here, with the modifications for the signature the Bing API should work again. At least I already could test it successfully in my implementation. :)

hswlab avatar Oct 06 '23 21:10 hswlab

@hswlab Thank you, noted this for work once I'll get to next pass of RE and fixes! (currently busy with another project)

neon-sunset avatar Oct 06 '23 21:10 neon-sunset

@neon-sunset I just added a pull request https://github.com/bsdayo/BingChat/pull/41

gunpal5 avatar Oct 07 '23 00:10 gunpal5

@hswlab I already know how to obtain a signature, but how should I use it in new communication methods?

chinazhaoht avatar Oct 07 '23 05:10 chinazhaoht

@chinazhaoht For websocket request with ChatHub, this string is currently set in the URL parameter of sec_access_token. wss://sydney.bing.com/sydney/ChatHub?sec_access_token=TheSignature

If you use the Bing API, you have to wait until the code in the API is customized. @gunpal5 seems to have already an update for this issue. :)

hswlab avatar Oct 07 '23 07:10 hswlab

I used the signature in the X-Sydney-Encryptedconversationsignature header from the create conversation response, URL-encoded it, and passed it as the sec_access_token to the chathub interface, but the chathub still returns "unauthorized request" and "chathub not authorized".

chinazhaoht avatar Oct 07 '23 11:10 chinazhaoht

@chinazhaoht save your time and use this PR: https://github.com/bsdayo/BingChat/pull/41

gunpal5 avatar Oct 07 '23 11:10 gunpal5

@gunpal5 Thank you, I have already solved this problem.

chinazhaoht avatar Oct 08 '23 03:10 chinazhaoht