From 8321a7d3c5672ba13d383924f28981e8ff775c52 Mon Sep 17 00:00:00 2001
From: ValueOn AG
Date: Mon, 16 Feb 2026 16:45:35 +0100
Subject: [PATCH] fix: after auth, re-navigate to clean meeting URL with auth
cookies instead of waiting on anon=true page
Co-authored-by: Cursor
---
src/bot/orchestrator.ts | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/src/bot/orchestrator.ts b/src/bot/orchestrator.ts
index 4b3d1b8..fc89764 100644
--- a/src/bot/orchestrator.ts
+++ b/src/bot/orchestrator.ts
@@ -216,20 +216,23 @@ export class BotOrchestrator {
if (authSuccess) {
this._logger.info('Authentication via "Sign in" link succeeded');
- // After the hybrid login flow, Teams goes through a redirect chain.
- // It may briefly visit /v2/ then land back on light-meetings (now authenticated).
- // We just need to wait for the redirects to settle and for the page to stabilize.
- // The Join button (#prejoin-join-button) will appear once the page is ready.
- this._logger.info('Auth complete. Waiting for redirects to settle and Join button to appear...');
+ // 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...');
- // Wait for the redirect chain to finish (URL stops changing)
- await this._page!.waitForTimeout(5000);
+ // 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
+ await this._page!.waitForTimeout(3000);
const settledUrl = this._page!.url();
- this._logger.info(`Post-auth settled URL: ${settledUrl.substring(0, 100)}`);
-
- // The authenticated join flow will be handled by joinMeetingLobbyFlow() below,
- // which will find the "Join now" button and click it.
+ this._logger.info(`Post-auth re-navigation URL: ${settledUrl.substring(0, 100)}`);
} else {
this._logger.warn('Authentication via "Sign in" failed - continuing as anonymous');
}