mathworks / matlab-proxy

Python® package enables you to open a MATLAB® desktop in a web browser tab.
Other
48 stars 23 forks source link

MATLAB Proxy randomly asks for authentication on first connection #37

Closed robinkar closed 2 months ago

robinkar commented 2 months ago

Summary

Hello, we noticed a problem where matlab-proxy occasionally asks for authentication when first connecting to it, even though the authentication was successful (matlab-proxy-session-... cookie gets set). I.e. the user is presented with this screen after visiting /matlab?mwi-auth-token=... with the correct auth token: Screenshot from 2024-09-17 13-04-11

Clicking the submit button or refreshing the page does allow the user to continue to MATLAB successfully.

I spent some time tracing the problem and it seems that the frontend does not behave correctly when the /authenticate request finishes before the /get_env_config request. Thus, adding await asyncio.sleep(0.5) to the get_env_config request handler allows reproducing it consistently if cookies are cleared between attempts. Screenshot from 2024-09-17 13-06-48

This was tested with matlab-proxy versions 0.18.1 and 0.21.0 with Firefox 128.2.0esr and Chromium 128.0.6613.119. We are using matlab-proxy though Open OnDemand.

Browser(s) used

Chrome, Firefox

Script output

No response

prabhakk-mw commented 2 months ago

Hi @robinkar

Thank you for the detailed report and for investing time in narrowing this down!

We will investigate and report back.

prabhakk-mw commented 2 months ago

@robinkar could you please confirm that v0.22.0 of the matlab proxy fixes this issue in your environment as well?

Thanks!

robinkar commented 2 months ago

@robinkar could you please confirm that v0.22.0 of the matlab proxy fixes this issue in your environment as well?

Thanks!

v0.22.0 does seem to fix the issue. Thanks for the quick fix!