@msout/microsoft-webauth 0.0.8 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/auth.js +10 -5
- package/src/config.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@msout/microsoft-webauth",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"description": "Microsoft web authentication module, using playwright to automate the login process and retrieve cookies for authenticated sessions.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"bin": {
|
package/src/auth.js
CHANGED
|
@@ -130,15 +130,20 @@ async function waitForAuthSuccess(page, targetUrl) {
|
|
|
130
130
|
]);
|
|
131
131
|
logger.success('Outlook mail interface detected.');
|
|
132
132
|
} else {
|
|
133
|
-
// OneNote default behavior
|
|
134
|
-
|
|
133
|
+
// OneNote default behavior — wait for the authenticated notebooks interface.
|
|
134
|
+
// IMPORTANT: We must require /notebooks in the URL to avoid matching the
|
|
135
|
+
// unauthenticated marketing landing page (onenote.cloud.microsoft/en-us)
|
|
136
|
+
// which also matches the old hostname-only check and caused premature auth saving.
|
|
137
|
+
logger.info('Waiting for redirection to authenticated notebooks interface...');
|
|
135
138
|
await Promise.any([
|
|
136
|
-
|
|
139
|
+
// Primary: URL must contain /notebooks (authenticated app)
|
|
140
|
+
page.waitForURL(url => url.toString().includes('/notebooks'), { timeout: 60000 }),
|
|
141
|
+
// Fallback UI elements that only appear when actually signed in
|
|
137
142
|
page.waitForSelector('text="My notebooks"', { state: 'visible', timeout: 60000 }),
|
|
138
143
|
page.waitForSelector('text="Create new notebook"', { state: 'visible', timeout: 60000 }),
|
|
139
|
-
page.waitForSelector('text="Welcome, "', { state: 'visible', timeout: 60000 })
|
|
144
|
+
page.waitForSelector('text="Welcome, "', { state: 'visible', timeout: 60000 }),
|
|
140
145
|
]);
|
|
141
|
-
logger.success('
|
|
146
|
+
logger.success('Authenticated notebooks interface detected.');
|
|
142
147
|
}
|
|
143
148
|
}
|
|
144
149
|
|
package/src/config.js
CHANGED
|
@@ -37,7 +37,7 @@ async function ensureAuthDir(authFilePath) {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
const DEFAULT_AUTH_FILE = getDefaultAuthFilePath();
|
|
40
|
-
const ONENOTE_URL = 'https://onenote.cloud.microsoft/
|
|
40
|
+
const ONENOTE_URL = 'https://onenote.cloud.microsoft/notebooks';
|
|
41
41
|
const OUTLOOK_URL = 'https://outlook.cloud.microsoft/mail/';
|
|
42
42
|
|
|
43
43
|
module.exports = {
|