Skip to content

Commit 3b0ca51

Browse files
authored
fix: OAuth login authority for MSA-based orgs (#591)
OAuth login requires special treatment for ADO orgs that are not hosted under MS tenants. The mapping for such orgs resolves tenant value as zero GUID `00000000-0000-0000-0000-000000000000`. And such orgs require "common" authority for issuing the auth token. ## GitHub issue number #587 ## **Associated Risks** None ## ✅ **PR Checklist** - [ ] **I have read the [contribution guidelines](https://github.com/microsoft/azure-devops-mcp/blob/main/CONTRIBUTING.md)** - [ ] **I have read the [code of conduct guidelines](https://github.com/microsoft/azure-devops-mcp/blob/main/CODE_OF_CONDUCT.md)** - [ ] Title of the pull request is clear and informative. - [ ] 👌 Code hygiene - [ ] 🔭 Telemetry added, updated, or N/A - [ ] 📄 Documentation added, updated, or N/A - [ ] 🛡️ Automated tests added, or N/A ## 🧪 **How did you test it?** E2E using VSCode as MCP Client
1 parent 851a34b commit 3b0ca51

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@azure-devops/mcp",
3-
"version": "2.2.0",
3+
"version": "2.2.1",
44
"description": "MCP server for interacting with Azure DevOps",
55
"license": "MIT",
66
"author": "Microsoft Corporation",

src/auth.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,23 @@ const scopes = ["499b84ac-1321-427f-aa17-267ca6975798/.default"];
77
class OAuthAuthenticator {
88
static clientId = "0d50963b-7bb9-4fe7-94c7-a99af00b5136";
99
static defaultAuthority = "https://login.microsoftonline.com/common";
10+
static zeroTenantId = "00000000-0000-0000-0000-000000000000";
1011

1112
private accountId: AccountInfo | null;
1213
private publicClientApp: PublicClientApplication;
1314

1415
constructor(tenantId?: string) {
1516
this.accountId = null;
17+
18+
let authority = OAuthAuthenticator.defaultAuthority;
19+
if (tenantId && tenantId !== OAuthAuthenticator.zeroTenantId) {
20+
authority = `https://login.microsoftonline.com/${tenantId}`;
21+
}
22+
1623
this.publicClientApp = new PublicClientApplication({
1724
auth: {
1825
clientId: OAuthAuthenticator.clientId,
19-
authority: tenantId ? `https://login.microsoftonline.com/${tenantId}` : OAuthAuthenticator.defaultAuthority,
26+
authority,
2027
},
2128
});
2229
}

src/version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const packageVersion = "2.2.0";
1+
export const packageVersion = "2.2.1";

0 commit comments

Comments
 (0)