@mathismeadows/roamer-device-auth 1.4.0 → 1.4.2
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/roamer-device-auth.mjs +10 -3
package/package.json
CHANGED
package/roamer-device-auth.mjs
CHANGED
|
@@ -312,8 +312,15 @@ async function refreshTokens(refreshToken) {
|
|
|
312
312
|
return response.json();
|
|
313
313
|
}
|
|
314
314
|
|
|
315
|
-
|
|
316
|
-
|
|
315
|
+
// AUTH-52: carries the same client identity the loopback flow already sends at DCR
|
|
316
|
+
// registration, so the server's device-code confirm/success/failure/contact-email pages can
|
|
317
|
+
// name which client each sign-in prompt is actually for, instead of a generic message.
|
|
318
|
+
async function startDeviceFlow(clientSlug) {
|
|
319
|
+
const response = await fetch(`${ROAMER_MCP_ORIGIN}/oauth/device/start`, {
|
|
320
|
+
method: "POST",
|
|
321
|
+
headers: { "Content-Type": "application/json" },
|
|
322
|
+
body: JSON.stringify({ client_name: clientSlug }),
|
|
323
|
+
});
|
|
317
324
|
if (!response.ok) {
|
|
318
325
|
throw new Error(`Device flow start failed: ${response.status} ${await response.text()}`);
|
|
319
326
|
}
|
|
@@ -392,7 +399,7 @@ async function doGetValidTokens(clientSlug, forceRefresh) {
|
|
|
392
399
|
let resuming = Boolean(device);
|
|
393
400
|
if (!resuming) {
|
|
394
401
|
log("Starting sign-in...");
|
|
395
|
-
device = await startDeviceFlow();
|
|
402
|
+
device = await startDeviceFlow(clientSlug);
|
|
396
403
|
await writePendingFlow(clientSlug, device);
|
|
397
404
|
} else {
|
|
398
405
|
log("Resuming an already-in-progress sign-in (a prior process was restarted before it finished)...");
|