From 7abd123404563f1494802d9a29b0dc9f55abc7f7 Mon Sep 17 00:00:00 2001 From: ValueOn AG Date: Mon, 16 Feb 2026 17:05:14 +0100 Subject: [PATCH] fix: stay on light-meetings after auth, skip name input, join directly with auth cookies Co-authored-by: Cursor --- src/bot/joinProcedure.ts | 11 ++++++----- src/bot/orchestrator.ts | 21 +++++++-------------- 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/src/bot/joinProcedure.ts b/src/bot/joinProcedure.ts index a9ea7c0..97ed58d 100644 --- a/src/bot/joinProcedure.ts +++ b/src/bot/joinProcedure.ts @@ -131,11 +131,12 @@ export class JoinProcedure { this._logger.info(`Starting lobby join flow... (authenticated: ${this._isAuthenticated})`); if (this._isAuthenticated) { - // Authenticated join: wait for the authenticated pre-join page. - // Proof that we're on the RIGHT page: no name input field exists - // (the anonymous page has input[placeholder="Type your name"]). - // Retry up to 5 times, every 5 seconds. - await this._waitForAuthenticatedPreJoinPage(); + // Authenticated join: Auth cookies are set but we're on the light-meetings + // page (Teams blocks /v2/ for headless browsers). We skip entering a name + // and just click "Join now" directly. Teams will use the auth cookies to + // identify the user even on the light-meetings page. + this._logger.info('Authenticated join on light-meetings: skipping name, clicking Join now directly...'); + await this._page.waitForTimeout(2000); } else { // Anonymous join: enter bot name in the name input field await this._enterBotName(); diff --git a/src/bot/orchestrator.ts b/src/bot/orchestrator.ts index fc89764..a9d72f5 100644 --- a/src/bot/orchestrator.ts +++ b/src/bot/orchestrator.ts @@ -216,23 +216,16 @@ export class BotOrchestrator { if (authSuccess) { this._logger.info('Authentication via "Sign in" link succeeded'); - // Auth cookies are now set. The current page is still on light-meetings - // with anon=true — which keeps showing the anonymous experience regardless - // of auth cookies. We need to start fresh: navigate to the ORIGINAL meeting - // URL (without anon=true). With auth cookies set, Teams will route to the - // authenticated experience (no name input, account name shown). - this._logger.info('Auth complete. Re-navigating to meeting URL with auth cookies...'); + // Auth cookies are now set. Teams /v2/ blocks headless browsers, + // so we stay on the light-meetings page and join from here. + // The auth cookies will identify us to Teams even via light-meetings. + // We skip entering a name and just click "Join now" directly. + this._logger.info('Auth complete. Staying on light-meetings, will join with auth cookies...'); - // Navigate to the clean meeting URL — Teams will go through launcher again - // but this time with auth cookies, so "Continue on this browser" should - // lead to the authenticated pre-join page. - await this._joinProcedure!.startMeetingLauncherFlow(this._meetingUrl); - - // Wait for the page to settle after the new navigation + // Wait for the page to settle after the auth redirect chain await this._page!.waitForTimeout(3000); - const settledUrl = this._page!.url(); - this._logger.info(`Post-auth re-navigation URL: ${settledUrl.substring(0, 100)}`); + this._logger.info(`Post-auth settled URL: ${settledUrl.substring(0, 100)}`); } else { this._logger.warn('Authentication via "Sign in" failed - continuing as anonymous'); }