Open lianghsun opened 7 months ago
Hi I am facing the same error!! Did you got it working?
@karankapur999 Not yet
Hi,
I am facing a similar error!!
Did you get it working?
facing the same error, anybody got it working?
That's so bad! I'm facing the same error. I found that Copilot uses WebSocket, while the web uses HTTP. Perhaps the error occurs because of this
Authentication works differently in copilot mode than when using the full app. Instead of relying on the header_auth_callback, you have to supply an access_token via your frontend Javascript in the call to window.mountChainlitWidget(). header_auth_callback is not called in copilot mode.
You can see access_token in the widget configuration section here: https://docs.chainlit.io/deploy/copilot
You can see how to create the access_token in the Authentication section at the bottom of that page.
This is also discussed here: https://github.com/Chainlit/chainlit/issues/756
I've been considering that anything related to tokens would likely utilize
header_auth_callback(headers: Dict)
. I attempted to create a mock login (which guarantees authentication success regardless of the situation) to capture headers sent by the nginx reverse proxy. This approach works in app mode, but fails to receive headers in copilot mode, as illustrated in the attached screenshot:mock login
App mode do return headers
Using the developer tools, I noticed an error message at
index.js:78
, indicating an unauthorized access attempt:Copilot mode
App mode
This issue does not occur in app mode, only in copilot mode. The current problem is that I intend to use headers for authentication in copilot, but the server side does not receive any headers, thus failing to verify identity. Even with mock login (which should ensure authentication success), my simple HTML page displays an unauthorized access error.
Could you advise on how to resolve this issue? Thank you.