From d8d1ffec1758e410d953eb96f2c01258d1a5103d Mon Sep 17 00:00:00 2001
From: ValueOn AG
Date: Mon, 16 Feb 2026 13:02:36 +0100
Subject: [PATCH] fix: after auth login, navigate back to meeting URL
(Microsoft redirects to M365 instead of meeting)
Co-authored-by: Cursor
---
src/bot/orchestrator.ts | 26 +++++++++++++++++++++-----
1 file changed, 21 insertions(+), 5 deletions(-)
diff --git a/src/bot/orchestrator.ts b/src/bot/orchestrator.ts
index 9970b3a..38ce7a2 100644
--- a/src/bot/orchestrator.ts
+++ b/src/bot/orchestrator.ts
@@ -213,19 +213,35 @@ export class BotOrchestrator {
if (authSuccess) {
this._logger.info('Authentication via "Sign in" link succeeded');
- // After auth, Teams redirects back to the authenticated pre-join page
- // within Teams v2 (/v2/) -- wait for it to load
- await this._page!.waitForTimeout(5000);
+ await this._page!.waitForTimeout(3000);
const postAuthUrl = this._page!.url();
- this._logger.info(`Post-auth URL: ${postAuthUrl.substring(0, 80)}`);
+ this._logger.info(`Post-auth URL: ${postAuthUrl.substring(0, 100)}`);
+
+ // After login, Microsoft may redirect to M365/Office instead of back to the meeting.
+ // We need to navigate back to the meeting URL -- now with the auth session active.
+ // This time, Teams should recognize the auth and show the authenticated pre-join page.
+ if (!postAuthUrl.includes('teams.microsoft.com/v2') || !postAuthUrl.includes('meet')) {
+ this._logger.info('Not on Teams meeting page after auth - navigating back to meeting URL...');
+ await this._page!.goto(this._meetingUrl, {
+ waitUntil: 'domcontentloaded',
+ timeout: 30000,
+ });
+
+ // Handle launcher dialog if it appears again
+ await this._joinProcedure!.handleLauncherIfPresent();
+ await this._page!.waitForTimeout(5000);
+
+ const meetingPageUrl = this._page!.url();
+ this._logger.info(`After re-navigation to meeting: ${meetingPageUrl.substring(0, 100)}`);
+ }
// Verify we're on the authenticated pre-join page
const pageText = await this._page!.evaluate(() => document.body?.innerText?.substring(0, 500) || '');
if (pageText.includes('Join now')) {
this._logger.info('On authenticated pre-join page with "Join now" button');
} else {
- this._logger.warn(`Post-auth page content: ${pageText.substring(0, 200)}`);
+ this._logger.warn(`Post-auth page content: ${pageText.substring(0, 300)}`);
}
} else {
this._logger.warn('Authentication via "Sign in" failed - continuing as anonymous');