JupyterLab "Couldn't authenticate WebSocket connection"

Hello,

I tried to add JupyterLab in an IFrame, when I removed the token everything was fine and it worked as expected but when I added a token to it, nothing worked and it gave me the error “Couldn’t authenticate WebSocket connection”.

I searched for a long time for a solution but most users who asked the same question were ignored. Here is an example: https://discourse.jupyter.org/t/jupyterlab-local-docker-image-in-iframe-gives-websocket-authentication-errors/15221

I will add that without an IFrame it works fine (even without SSL).

I will ask, how we can add a JupyterLab in an IFrame with some authentications (tokens or AWS Cognito).

Thank you.