fix: after auth login, just WAIT for Teams redirect chain to complete (do NOT navigate back to meeting URL)
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
5d2335dd26
commit
325de1c9ae
1 changed files with 18 additions and 24 deletions
|
|
@ -213,32 +213,26 @@ 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');
|
||||||
await this._page!.waitForTimeout(3000);
|
|
||||||
|
|
||||||
const postAuthUrl = this._page!.url();
|
// After login, Teams does a redirect chain automatically:
|
||||||
this._logger.info(`Post-auth URL: ${postAuthUrl.substring(0, 100)}`);
|
// Login → M365 → Teams v2 → Pre-Join page (/v2/)
|
||||||
|
// Do NOT navigate anywhere. Just wait for the redirect chain to complete
|
||||||
// After login, Microsoft redirects to M365 (m365.cloud.microsoft/chat/).
|
// and for the "Join now" button to appear on the Teams v2 pre-join page.
|
||||||
// Navigate back to the meeting URL. Now with auth cookies set,
|
this._logger.info('Waiting for Teams to redirect to authenticated pre-join page...');
|
||||||
// clicking "Continue on this browser" should lead to the authenticated
|
|
||||||
// Teams v2 Pre-Join page (with meeting title, no name input, "Room audio" option).
|
|
||||||
this._logger.info('Navigating back to meeting URL after auth...');
|
|
||||||
await this._page!.goto(this._meetingUrl, {
|
|
||||||
waitUntil: 'domcontentloaded',
|
|
||||||
timeout: 30000,
|
|
||||||
});
|
|
||||||
|
|
||||||
// Click "Continue on this browser" - this time with auth cookies
|
|
||||||
// it should lead to the authenticated pre-join page
|
|
||||||
await this._joinProcedure!.handleLauncherIfPresent();
|
|
||||||
|
|
||||||
// Wait for Teams v2 pre-join page to load
|
// Wait for the #prejoin-join-button to appear (up to 30 seconds)
|
||||||
await this._page!.waitForTimeout(8000);
|
// This button only exists on the Teams v2 authenticated pre-join page
|
||||||
|
const joinButtonSelector = '#prejoin-join-button, button[data-tid="prejoin-join-button"]';
|
||||||
const postNavUrl = this._page!.url();
|
try {
|
||||||
const postNavContent = await this._page!.evaluate(() => document.body?.innerText?.substring(0, 300) || '');
|
await this._page!.waitForSelector(joinButtonSelector, { timeout: 30000, state: 'visible' });
|
||||||
this._logger.info(`Post-auth navigation URL: ${postNavUrl.substring(0, 100)}`);
|
const currentUrl = this._page!.url();
|
||||||
this._logger.info(`Post-auth page content: ${postNavContent.substring(0, 200)}`);
|
this._logger.info(`Arrived at authenticated pre-join page: ${currentUrl.substring(0, 80)}`);
|
||||||
|
} catch {
|
||||||
|
const currentUrl = this._page!.url();
|
||||||
|
const pageContent = await this._page!.evaluate(() => document.body?.innerText?.substring(0, 300) || '');
|
||||||
|
this._logger.warn(`Join button not found after auth redirect. URL: ${currentUrl.substring(0, 80)}`);
|
||||||
|
this._logger.warn(`Page content: ${pageContent.substring(0, 200)}`);
|
||||||
|
}
|
||||||
|
|
||||||
// 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) || '');
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue