How to run IBKR TWS/Gateway/WebApi headless on Linux?

Looking to run IB's API (TWS/Gateway/WebApi) on a headless Linux server to get market data and execute trades. Main challenge: IB requires browser login which is problematic for a headless setup, especially with connection drops.

Has anyone solved this? Looking for a reliable way to run this completely headless.

Would appreciate any tips or guides!