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 || ''; waitUntil: 'domcontentloaded',
const passcode = parsed.passcode || ''; timeout: 30000,
});
// 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) { // Click "Continue on this browser" - this time with auth cookies
this._logger.info(`Trying authenticated meeting URL: ${url.substring(0, 80)}`); // it should lead to the authenticated pre-join page
try { await this._joinProcedure!.handleLauncherIfPresent();
await this._page!.goto(url, {
waitUntil: 'domcontentloaded', // Wait for Teams v2 pre-join page to load
timeout: 20000, await this._page!.waitForTimeout(8000);
});
await this._page!.waitForTimeout(5000); const postNavUrl = this._page!.url();
const postNavContent = await this._page!.evaluate(() => document.body?.innerText?.substring(0, 300) || '');
const resultUrl = this._page!.url(); this._logger.info(`Post-auth navigation URL: ${postNavUrl.substring(0, 100)}`);
const pageContent = await this._page!.evaluate(() => document.body?.innerText?.substring(0, 500) || ''); this._logger.info(`Post-auth page content: ${postNavContent.substring(0, 200)}`);
this._logger.info(`Result URL: ${resultUrl.substring(0, 100)}`);
this._logger.info(`Page content: ${pageContent.substring(0, 200)}`);
// Check if we have the authenticated pre-join (no "Type your name", has "Join now")
if (pageContent.includes('Join now') && !pageContent.includes('Type your name') && !pageContent.includes('Enter the name')) {
this._logger.info('Found authenticated pre-join page!');
break;
}
// If launcher appears, DON'T click "Continue on this browser" (leads to anon)
// Instead try the next URL
if (pageContent.includes('Continue on this browser')) {
this._logger.info('Launcher appeared - skipping (would lead to anonymous)');
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) || '');