fix: after auth login, click 'Continue on this browser' instead of skipping launcher (auth cookies now set)

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
ValueOn AG 2026-02-16 13:22:04 +01:00
parent 2c6a1f1d38
commit 5d2335dd26

View file

@ -219,55 +219,26 @@ export class BotOrchestrator {
this._logger.info(`Post-auth URL: ${postAuthUrl.substring(0, 100)}`); this._logger.info(`Post-auth URL: ${postAuthUrl.substring(0, 100)}`);
// After login, Microsoft redirects to M365 (m365.cloud.microsoft/chat/). // After login, Microsoft redirects to M365 (m365.cloud.microsoft/chat/).
// The "Continue on this browser" launcher ALWAYS leads to anonymous mode. // Navigate back to the meeting URL. Now with auth cookies set,
// Instead, navigate to teams.cloud.microsoft and use the meeting join from there. // clicking "Continue on this browser" should lead to the authenticated
// teams.cloud.microsoft is the new Teams domain where the auth session lives. // Teams v2 Pre-Join page (with meeting title, no name input, "Room audio" option).
const { parseMeetingUrl } = await import('./meetingUrlParser'); this._logger.info('Navigating back to meeting URL after auth...');
const parsed = parseMeetingUrl(this._meetingUrl); await this._page!.goto(this._meetingUrl, {
const meetingId = parsed.meetingId || '';
const passcode = parsed.passcode || '';
// Navigate to Teams on the cloud.microsoft domain (where auth cookies are)
// and try to join the meeting from within the authenticated app
const teamsCloudUrls = [
// Direct meeting URL on new Teams domain
`https://teams.cloud.microsoft/meet/${meetingId}${passcode ? '?p=' + passcode : ''}`,
// Original meeting URL (teams.microsoft.com)
this._meetingUrl,
];
for (const url of teamsCloudUrls) {
this._logger.info(`Trying authenticated meeting URL: ${url.substring(0, 80)}`);
try {
await this._page!.goto(url, {
waitUntil: 'domcontentloaded', waitUntil: 'domcontentloaded',
timeout: 20000, timeout: 30000,
}); });
await this._page!.waitForTimeout(5000);
const resultUrl = this._page!.url(); // Click "Continue on this browser" - this time with auth cookies
const pageContent = await this._page!.evaluate(() => document.body?.innerText?.substring(0, 500) || ''); // it should lead to the authenticated pre-join page
this._logger.info(`Result URL: ${resultUrl.substring(0, 100)}`); await this._joinProcedure!.handleLauncherIfPresent();
this._logger.info(`Page content: ${pageContent.substring(0, 200)}`);
// Check if we have the authenticated pre-join (no "Type your name", has "Join now") // Wait for Teams v2 pre-join page to load
if (pageContent.includes('Join now') && !pageContent.includes('Type your name') && !pageContent.includes('Enter the name')) { await this._page!.waitForTimeout(8000);
this._logger.info('Found authenticated pre-join page!');
break;
}
// If launcher appears, DON'T click "Continue on this browser" (leads to anon) const postNavUrl = this._page!.url();
// Instead try the next URL const postNavContent = await this._page!.evaluate(() => document.body?.innerText?.substring(0, 300) || '');
if (pageContent.includes('Continue on this browser')) { this._logger.info(`Post-auth navigation URL: ${postNavUrl.substring(0, 100)}`);
this._logger.info('Launcher appeared - skipping (would lead to anonymous)'); this._logger.info(`Post-auth page content: ${postNavContent.substring(0, 200)}`);
continue;
}
} catch (navErr) {
this._logger.warn(`Navigation to ${url.substring(0, 60)} failed: ${navErr}`);
continue;
}
}
// 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) || '');