@mcp-abap-adt/auth-providers 1.1.0 → 1.2.0

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.
@@ -11,6 +11,8 @@ const interfaces_1 = require("@mcp-abap-adt/interfaces");
11
11
  const browserAuth_1 = require("../auth/browserAuth");
12
12
  const tokenRefresher_1 = require("../auth/tokenRefresher");
13
13
  const BaseTokenProvider_1 = require("./BaseTokenProvider");
14
+ /** How long an interactive login may wait for its callback. */
15
+ const LOGIN_TIMEOUT_MS = 30 * 1000;
14
16
  /**
15
17
  * Authorization Code token provider
16
18
  *
@@ -100,18 +102,15 @@ class AuthorizationCodeProvider extends BaseTokenProvider_1.BaseTokenProvider {
100
102
  uaaUrl: authConfig.uaaUrl,
101
103
  clientId: authConfig.uaaClientId,
102
104
  });
103
- // Wrap startBrowserAuth with timeout
104
- const timeoutMs = 30 * 1000; // 30 seconds
105
- const timeoutPromise = new Promise((_, reject) => {
106
- setTimeout(() => {
107
- reject(new Error(`Authentication timeout after ${timeoutMs / 1000} seconds. Please try again.`));
108
- }, timeoutMs);
109
- });
110
- const result = await Promise.race([
111
- (0, browserAuth_1.startBrowserAuth)(authConfig, browser, this.logger || undefined, // Pass logger to browserAuth
112
- redirectPort),
113
- timeoutPromise,
114
- ]);
105
+ // One timeout, owned by whoever owns the socket.
106
+ //
107
+ // This used to race startBrowserAuth against a second timer of the same
108
+ // 30 seconds, so which fired was down to scheduling — and when the outer
109
+ // one won, the provider rejected while the callback port was still bound.
110
+ // That timer was never cleared either, keeping the event loop alive for the
111
+ // rest of the window after a login that succeeded in a second.
112
+ const result = await (0, browserAuth_1.startBrowserAuth)(authConfig, browser, this.logger || undefined, // Pass logger to browserAuth
113
+ redirectPort, LOGIN_TIMEOUT_MS);
115
114
  this.logger?.info('[AuthorizationCodeProvider] Login completed', {
116
115
  hasAccessToken: !!result.accessToken,
117
116
  hasRefreshToken: !!result.refreshToken,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcp-abap-adt/auth-providers",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Token providers for MCP ABAP ADT auth-broker",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -55,23 +55,23 @@
55
55
  "prepublishOnly": "npm run build"
56
56
  },
57
57
  "engines": {
58
- "node": ">=18.0.0"
58
+ "node": ">=18.2.0"
59
59
  },
60
60
  "dependencies": {
61
- "@mcp-abap-adt/interfaces": "^2.3.0",
61
+ "@mcp-abap-adt/interfaces": "^11.4.0",
62
62
  "axios": "^1.13.5",
63
63
  "express": "^5.1.0",
64
64
  "open": "^11.0.0"
65
65
  },
66
66
  "devDependencies": {
67
67
  "@biomejs/biome": "^2.3.14",
68
+ "@jest/globals": "^30.2.0",
68
69
  "@mcp-abap-adt/auth-stores": "^1.0.1",
69
70
  "@mcp-abap-adt/logger": "^0.1.4",
70
71
  "@types/express": "^5.0.5",
71
72
  "@types/jest": "^30.0.0",
72
73
  "@types/js-yaml": "^4.0.9",
73
74
  "@types/node": "^25.2.3",
74
- "@jest/globals": "^30.2.0",
75
75
  "jest": "^30.2.0",
76
76
  "jest-util": "^30.2.0",
77
77
  "js-yaml": "^4.1.1",