powerautomate-mcp 0.7.6 → 0.7.8
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/dist/index.js +32 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -14894,13 +14894,38 @@ async function createDeviceCodeAuthProvider(config, silentOnly = false) {
|
|
|
14894
14894
|
`Silent token acquisition failed for scopes: ${mutableScopes.join(", ")}. Resource may not be registered in the app registration. Re-run --setup to update permissions.`
|
|
14895
14895
|
);
|
|
14896
14896
|
}
|
|
14897
|
+
let emptyUserCodeDetected = false;
|
|
14897
14898
|
try {
|
|
14898
14899
|
logger.info("Starting device code authentication flow");
|
|
14899
14900
|
const deviceCodeRequest = {
|
|
14900
14901
|
scopes: mutableScopes,
|
|
14901
14902
|
deviceCodeCallback: (response) => {
|
|
14903
|
+
const url = response.verificationUri || "https://microsoft.com/devicelogin";
|
|
14904
|
+
const code = response.userCode || "(code missing)";
|
|
14905
|
+
logger.info(
|
|
14906
|
+
{
|
|
14907
|
+
hasMessage: !!response.message,
|
|
14908
|
+
hasUserCode: !!response.userCode,
|
|
14909
|
+
hasVerificationUri: !!response.verificationUri,
|
|
14910
|
+
expiresIn: response.expiresIn,
|
|
14911
|
+
interval: response.interval
|
|
14912
|
+
},
|
|
14913
|
+
"Device-code response received"
|
|
14914
|
+
);
|
|
14915
|
+
if (!response.userCode) {
|
|
14916
|
+
emptyUserCodeDetected = true;
|
|
14917
|
+
logger.error(
|
|
14918
|
+
"Device-code response is missing userCode \u2014 tenant likely blocks device-code flow"
|
|
14919
|
+
);
|
|
14920
|
+
} else if (!response.message) {
|
|
14921
|
+
logger.warn(
|
|
14922
|
+
{ userCode: code, verificationUri: url },
|
|
14923
|
+
"Device-code response missing 'message' field \u2014 using synthesized fallback"
|
|
14924
|
+
);
|
|
14925
|
+
}
|
|
14926
|
+
const display = response.message || `To sign in, open ${url} in a browser on any device and enter the code ${code} to authenticate.`;
|
|
14902
14927
|
console.log("");
|
|
14903
|
-
console.log(` \x1B[36m?\x1B[0m ${
|
|
14928
|
+
console.log(` \x1B[36m?\x1B[0m ${display}`);
|
|
14904
14929
|
console.log("");
|
|
14905
14930
|
console.log(` \x1B[33m\u26A0\x1B[0m SECURITY: Do not share this code. It expires in ${Math.floor((response.expiresIn ?? 900) / 60)} minutes.`);
|
|
14906
14931
|
console.log("");
|
|
@@ -14920,6 +14945,12 @@ async function createDeviceCodeAuthProvider(config, silentOnly = false) {
|
|
|
14920
14945
|
if (err instanceof AuthenticationError) {
|
|
14921
14946
|
throw err;
|
|
14922
14947
|
}
|
|
14948
|
+
if (emptyUserCodeDetected) {
|
|
14949
|
+
throw new AuthenticationError(
|
|
14950
|
+
`Device-code flow returned no usable code from your tenant. This typically means one of: (1) your tenant blocks device-code flow via a Conditional Access policy \u2014 ask your tenant admin to allow device-code grants for this app, (2) the app registration is missing 'Allow public client flows' \u2014 set it under Authentication > Advanced settings in the Azure Portal and re-run --setup, or (3) a corporate proxy is stripping OAuth fields from the response \u2014 try a direct internet connection to confirm. Underlying MSAL error: ${err instanceof Error ? err.message : String(err)}`,
|
|
14951
|
+
err
|
|
14952
|
+
);
|
|
14953
|
+
}
|
|
14923
14954
|
throw new AuthenticationError(
|
|
14924
14955
|
`Failed to authenticate: ${err instanceof Error ? err.message : String(err)}`,
|
|
14925
14956
|
err
|