fix: after auth login, navigate back to meeting URL (Microsoft redirects to M365 instead of meeting)

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
ValueOn AG 2026-02-16 13:02:36 +01:00
parent 121c70e60a
commit d8d1ffec17

View file

@ -213,19 +213,35 @@ export class BotOrchestrator {
if (authSuccess) { if (authSuccess) {
this._logger.info('Authentication via "Sign in" link succeeded'); this._logger.info('Authentication via "Sign in" link succeeded');
// After auth, Teams redirects back to the authenticated pre-join page await this._page!.waitForTimeout(3000);
// within Teams v2 (/v2/) -- wait for it to load
await this._page!.waitForTimeout(5000);
const postAuthUrl = this._page!.url(); 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 // Verify we're on the authenticated pre-join page
const pageText = await this._page!.evaluate(() => document.body?.innerText?.substring(0, 500) || ''); const pageText = await this._page!.evaluate(() => document.body?.innerText?.substring(0, 500) || '');
if (pageText.includes('Join now')) { if (pageText.includes('Join now')) {
this._logger.info('On authenticated pre-join page with "Join now" button'); this._logger.info('On authenticated pre-join page with "Join now" button');
} else { } else {
this._logger.warn(`Post-auth page content: ${pageText.substring(0, 200)}`); this._logger.warn(`Post-auth page content: ${pageText.substring(0, 300)}`);
} }
} else { } else {
this._logger.warn('Authentication via "Sign in" failed - continuing as anonymous'); this._logger.warn('Authentication via "Sign in" failed - continuing as anonymous');