@app-connect/core 1.7.21 → 1.7.22

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.
Files changed (42) hide show
  1. package/README.md +8 -1
  2. package/connector/developerPortal.js +4 -4
  3. package/docs/README.md +50 -0
  4. package/docs/architecture.md +93 -0
  5. package/docs/connectors.md +117 -0
  6. package/docs/handlers.md +125 -0
  7. package/docs/libraries.md +101 -0
  8. package/docs/models.md +144 -0
  9. package/docs/routes.md +115 -0
  10. package/docs/tests.md +73 -0
  11. package/handlers/admin.js +22 -2
  12. package/handlers/auth.js +51 -10
  13. package/handlers/log.js +4 -4
  14. package/handlers/managedAuth.js +446 -0
  15. package/index.js +264 -34
  16. package/lib/jwt.js +1 -1
  17. package/mcp/tools/createCallLog.js +5 -1
  18. package/mcp/tools/createContact.js +5 -1
  19. package/mcp/tools/createMessageLog.js +5 -1
  20. package/mcp/tools/findContactByName.js +5 -1
  21. package/mcp/tools/findContactByPhone.js +6 -2
  22. package/mcp/tools/getCallLog.js +5 -1
  23. package/mcp/tools/rcGetCallLogs.js +6 -2
  24. package/mcp/tools/updateCallLog.js +5 -1
  25. package/mcp/ui/App/lib/developerPortal.ts +1 -1
  26. package/package.json +72 -72
  27. package/releaseNotes.json +8 -0
  28. package/test/handlers/admin.test.js +34 -0
  29. package/test/handlers/auth.test.js +402 -6
  30. package/test/handlers/managedAuth.test.js +458 -0
  31. package/test/index.test.js +105 -0
  32. package/test/lib/jwt.test.js +15 -0
  33. package/test/mcp/tools/createCallLog.test.js +11 -0
  34. package/test/mcp/tools/createContact.test.js +58 -0
  35. package/test/mcp/tools/createMessageLog.test.js +15 -0
  36. package/test/mcp/tools/findContactByName.test.js +12 -0
  37. package/test/mcp/tools/findContactByPhone.test.js +12 -0
  38. package/test/mcp/tools/getCallLog.test.js +12 -0
  39. package/test/mcp/tools/rcGetCallLogs.test.js +56 -0
  40. package/test/mcp/tools/updateCallLog.test.js +14 -0
  41. package/test/routes/managedAuthRoutes.test.js +132 -0
  42. package/test/setup.js +2 -0
package/docs/models.md ADDED
@@ -0,0 +1,144 @@
1
+ # Models
2
+
3
+ The package uses Sequelize for durable application data and Dynamoose for selected config and cache workflows.
4
+
5
+ ## Sequelize Models
6
+
7
+ ### `models/sequelize.js`
8
+
9
+ Creates the shared Sequelize instance from `DATABASE_URL`.
10
+
11
+ ### `models/userModel.js`
12
+
13
+ Stores CRM-authenticated users.
14
+
15
+ | Field | Notes |
16
+ | --- | --- |
17
+ | `id` | Primary key; effectively `{crmUserId}-{platform}` |
18
+ | `rcAccountId` | RingCentral account id |
19
+ | `hostname` | CRM hostname or tenant host |
20
+ | `timezoneName` | User timezone name when available |
21
+ | `timezoneOffset` | Offset stored as a string |
22
+ | `platform` | Connector platform name |
23
+ | `accessToken` | OAuth access token or API key |
24
+ | `refreshToken` | OAuth refresh token |
25
+ | `tokenExpiry` | Access token expiry |
26
+ | `platformAdditionalInfo` | Connector-specific metadata such as `proxyId` or token URL |
27
+ | `hashedRcExtensionId` | Hashed RingCentral extension id |
28
+ | `userSettings` | Per-user settings JSON |
29
+
30
+ ### `models/callLogModel.js`
31
+
32
+ Stores the mapping between telephony sessions and CRM call logs.
33
+
34
+ | Field | Notes |
35
+ | --- | --- |
36
+ | `id` | Telephony call id |
37
+ | `sessionId` | Session id; also part of the composite primary key |
38
+ | `platform` | Connector platform |
39
+ | `thirdPartyLogId` | CRM log id |
40
+ | `userId` | App Connect user id |
41
+ | `contactId` | CRM contact id used for the log |
42
+
43
+ ### `models/messageLogModel.js`
44
+
45
+ Stores message-log linkage records.
46
+
47
+ | Field | Notes |
48
+ | --- | --- |
49
+ | `id` | Message id or conversation log id |
50
+ | `platform` | Connector platform |
51
+ | `conversationId` | Conversation identifier |
52
+ | `conversationLogId` | Shared key used to group related message logs |
53
+ | `thirdPartyLogId` | CRM log id |
54
+ | `userId` | App Connect user id |
55
+
56
+ ### `models/adminConfigModel.js`
57
+
58
+ Stores account-level admin configuration.
59
+
60
+ | Field | Notes |
61
+ | --- | --- |
62
+ | `id` | Hashed RingCentral account id |
63
+ | `userSettings` | Account-level settings policy |
64
+ | `customAdapter` | Obsolete field kept for compatibility |
65
+ | `adminAccessToken` | RingCentral admin access token |
66
+ | `adminRefreshToken` | RingCentral admin refresh token |
67
+ | `adminTokenExpiry` | Admin token expiry |
68
+ | `userMappings` | JSON mapping between CRM users and RingCentral extensions |
69
+
70
+ ### `models/cacheModel.js`
71
+
72
+ Stores temporary task state, mainly for async plugin work.
73
+
74
+ | Field | Notes |
75
+ | --- | --- |
76
+ | `id` | Task id, commonly `{userId}-{uuid}` |
77
+ | `status` | Task status such as `initialized`, `completed`, or `failed` |
78
+ | `userId` | Owning user |
79
+ | `cacheKey` | Logical task family |
80
+ | `data` | Optional task payload |
81
+ | `expiry` | Cleanup cutoff |
82
+
83
+ ### `models/accountDataModel.js`
84
+
85
+ Stores account-scoped cached data.
86
+
87
+ Composite primary key:
88
+
89
+ - `rcAccountId`
90
+ - `platformName`
91
+ - `dataKey`
92
+
93
+ Main usage in current code:
94
+
95
+ - cached contact lookups keyed as `contact-${phoneNumber}`
96
+
97
+ Helper export:
98
+
99
+ - `getOrRefreshAccountData()` which returns cached data unless `forceRefresh` is set
100
+
101
+ ### `models/callDownListModel.js`
102
+
103
+ Stores user-owned call-down queue items.
104
+
105
+ | Field | Notes |
106
+ | --- | --- |
107
+ | `id` | Primary key |
108
+ | `userId` | Owning user |
109
+ | `contactId` | CRM contact id |
110
+ | `contactType` | Contact entity type |
111
+ | `status` | Queue state such as `scheduled` or `called` |
112
+ | `scheduledAt` | Requested follow-up time |
113
+ | `lastCallAt` | Last call timestamp |
114
+
115
+ This model enables timestamps and indexes on `userId`, `status`, `scheduledAt`, and `userId + status`.
116
+
117
+ ### `models/llmSessionModel.js`
118
+
119
+ Stores a lightweight mapping from an LLM session id to a JWT token.
120
+
121
+ ## Dynamoose Models
122
+
123
+ ### `models/dynamo/connectorSchema.js`
124
+
125
+ Stores connector metadata used by proxy integrations.
126
+
127
+ Important role:
128
+
129
+ - source of truth for `Connector.getProxyConfig(proxyId)`
130
+
131
+ This schema is a dependency of auth, contact, log, admin, and proxy connector flows.
132
+
133
+ ### `models/dynamo/lockSchema.js`
134
+
135
+ Stores distributed lock state used by token refresh and similar coordination logic.
136
+
137
+ ### `models/dynamo/noteCacheSchema.js`
138
+
139
+ Stores note cache entries keyed by `sessionId`.
140
+
141
+ Main usage:
142
+
143
+ - `handlers/log.js` can read cached notes during server-side call logging
144
+ - `saveNoteCache()` writes entries with a TTL
package/docs/routes.md ADDED
@@ -0,0 +1,115 @@
1
+ # Core Routes
2
+
3
+ This page documents the non-MCP HTTP routes defined in `index.js`.
4
+
5
+ ## Route Design Notes
6
+
7
+ - Most routes accept a `jwtToken` query parameter and resolve the current user from it.
8
+ - Many routes emit analytics using request headers such as `rc-extension-id`, `rc-account-id`, `user-agent`, `developer-author-name`, and `eventAddedVia`.
9
+ - When the request header `is-debug` is set to `'true'`, route handlers can return `DebugTracer` output wrappers.
10
+ - Several routes are marked obsolete in code but still present for compatibility.
11
+
12
+ ## System And Metadata Routes
13
+
14
+ | Method | Path | Purpose |
15
+ | --- | --- | --- |
16
+ | `GET` | `/releaseNotes` | Merges package release notes with connector release notes |
17
+ | `GET` | `/crmManifest` | Returns a platform manifest, with optional server URL overrides |
18
+ | `GET` | `/isAlive` | Simple health check returning `OK` |
19
+ | `GET` | `/implementedInterfaces` | Reports which connector methods exist for a platform |
20
+ | `GET` | `/serverVersionInfo` | Returns manifest version data; marked obsolete in code |
21
+ | `GET` | `/.well-known/openai-apps-challenge` | Returns the ChatGPT verification code |
22
+ | `GET` | `/.well-known/oauth-protected-resource` | OAuth protected-resource metadata |
23
+ | `GET` | `/.well-known/oauth-authorization-server` | OAuth authorization-server metadata |
24
+ | `GET` | `/oauth/authorize_shim` | Rebuilds OAuth params and redirects to RingCentral |
25
+ | `POST` | `/oauth/register` | Returns RingCentral client credentials for the shim flow |
26
+
27
+ ## Authentication Routes
28
+
29
+ | Method | Path | Purpose |
30
+ | --- | --- | --- |
31
+ | `GET` | `/licenseStatus` | Checks connector-specific license status for the current user |
32
+ | `GET` | `/authValidation` | Verifies the current CRM auth session |
33
+ | `GET` | `/hostname` | Returns host-related info used during auth flows |
34
+ | `GET` | `/oauth-callback` | Completes connector OAuth and persists the user |
35
+ | `POST` | `/apiKeyLogin` | Handles API-key based login flows |
36
+ | `GET` | `/apiKeyManagedAuthState` | Returns required-field readiness for shared API-key auth |
37
+ | `POST` | `/unAuthorize` | Logs the user out of the CRM |
38
+ | `GET` | `/userInfoHash` | Returns a hash derived from user information |
39
+ | `GET` | `/ringcentral/oauth/callback` | Completes the admin RingCentral OAuth callback |
40
+
41
+ ## Admin Routes
42
+
43
+ | Method | Path | Purpose |
44
+ | --- | --- | --- |
45
+ | `POST` | `/admin/settings` | Validates RingCentral admin role and saves admin settings |
46
+ | `GET` | `/admin/settings` | Returns admin settings for the current account |
47
+ | `POST` | `/admin/userMapping` | Builds a mapping between CRM users and RingCentral extensions |
48
+ | `POST` | `/admin/reinitializeUserMapping` | Rebuilds user mappings from scratch |
49
+ | `GET` | `/admin/serverLoggingSettings` | Loads connector-specific server logging settings |
50
+ | `POST` | `/admin/serverLoggingSettings` | Updates connector-specific server logging settings |
51
+ | `GET` | `/admin/managedAuth` | Returns admin-facing managed-auth field definitions and masked stored values |
52
+ | `POST` | `/admin/managedAuth` | Upserts org-level or extension-level managed auth values |
53
+ | `GET` | `/ringcentral/admin/report` | Returns aggregated RingCentral call activity metrics |
54
+ | `GET` | `/ringcentral/admin/userReport` | Returns per-extension call and SMS metrics |
55
+
56
+ ## User Settings Routes
57
+
58
+ | Method | Path | Purpose |
59
+ | --- | --- | --- |
60
+ | `GET` | `/user/preloadSettings` | Loads settings used to bootstrap client-side configuration |
61
+ | `GET` | `/user/settings` | Returns merged user and admin settings |
62
+ | `POST` | `/user/settings` | Updates per-user settings, with connector hooks when present |
63
+
64
+ ## Contact Routes
65
+
66
+ | Method | Path | Purpose |
67
+ | --- | --- | --- |
68
+ | `GET` | `/contact` | Finds contacts by phone number |
69
+ | `POST` | `/contact` | Creates a new contact |
70
+ | `GET` | `/custom/contact/search` | Finds contacts by name |
71
+
72
+ ## Logging And Disposition Routes
73
+
74
+ | Method | Path | Purpose |
75
+ | --- | --- | --- |
76
+ | `POST` | `/callLog/cacheNote` | Stores a temporary note for server-side call logging |
77
+ | `GET` | `/callLog` | Looks up existing call logs by session id |
78
+ | `POST` | `/callLog` | Creates a CRM call log and stores the local linkage record |
79
+ | `PATCH` | `/callLog` | Updates an existing CRM call log |
80
+ | `PUT` | `/callDisposition` | Upserts call disposition data through the connector |
81
+ | `POST` | `/messageLog` | Creates or updates CRM logs for SMS, fax, and shared SMS |
82
+
83
+ ## Call-Down Routes
84
+
85
+ | Method | Path | Purpose |
86
+ | --- | --- | --- |
87
+ | `POST` | `/calldown` | Schedules a call-down item |
88
+ | `GET` | `/calldown` | Lists the current user's call-down items |
89
+ | `DELETE` | `/calldown/:id` | Removes a call-down item |
90
+ | `PATCH` | `/calldown/:id` | Updates or marks a call-down item |
91
+
92
+ ## Plugin And Debug Routes
93
+
94
+ | Method | Path | Purpose |
95
+ | --- | --- | --- |
96
+ | `GET` | `/debug/report/url` | Returns a presigned URL for error log upload |
97
+ | `POST` | `/pluginAsyncTask` | Returns async plugin task status and cleans up finished task cache entries |
98
+
99
+ ## Development-Only Mock Routes
100
+
101
+ These routes are only mounted when `IS_PROD === 'false'`.
102
+
103
+ | Method | Path | Purpose |
104
+ | --- | --- | --- |
105
+ | `POST` | `/registerMockUser` | Creates a mock user |
106
+ | `DELETE` | `/deleteMockUser` | Removes a mock user |
107
+ | `GET` | `/mockCallLog` | Reads mock call logs |
108
+ | `POST` | `/mockCallLog` | Creates a mock call log |
109
+ | `DELETE` | `/mockCallLog` | Clears mock call logs |
110
+
111
+ ## Operational Notes
112
+
113
+ - `createCoreRouter()` currently contains a large amount of orchestration logic in addition to route registration.
114
+ - Most route handlers duplicate a common pattern: decode JWT, load user, resolve connector, refresh auth, call handler, then track analytics.
115
+ - If route count continues growing, this file is a strong candidate for modular route extraction by feature area.
package/docs/tests.md ADDED
@@ -0,0 +1,73 @@
1
+ # Tests
2
+
3
+ This page maps the non-MCP test suite under `packages/core/test`.
4
+
5
+ ## Test Setup
6
+
7
+ | File | Purpose |
8
+ | --- | --- |
9
+ | `test/setup.js` | Shared test bootstrapping for Jest |
10
+ | `jest.config.js` | Package-local Jest configuration |
11
+
12
+ ## Connector Tests
13
+
14
+ | File | Coverage |
15
+ | --- | --- |
16
+ | `test/connector/registry.test.js` | Registry behavior, connector registration, and interface composition |
17
+ | `test/connector/proxy/engine.test.js` | Proxy request rendering, auth header building, and response mapping |
18
+ | `test/connector/proxy/index.test.js` | Proxy connector behavior across connector operations |
19
+ | `test/connector/proxy/sample.json` | Sample proxy config fixture used by tests |
20
+
21
+ ## Handler Tests
22
+
23
+ | File | Coverage |
24
+ | --- | --- |
25
+ | `test/handlers/admin.test.js` | Admin settings and reporting behavior |
26
+ | `test/handlers/auth.test.js` | OAuth, API-key login, and auth validation behavior |
27
+ | `test/handlers/contact.test.js` | Contact lookup and creation flows |
28
+ | `test/handlers/log.test.js` | Call-log and message-log workflows |
29
+ | `test/handlers/plugin.test.js` | Async plugin task polling and cleanup |
30
+ | `test/handlers/managedAuth.test.js` | Shared-auth field loading, encryption, masking, and login-time field resolution |
31
+
32
+ ## Route Tests
33
+
34
+ | File | Coverage |
35
+ | --- | --- |
36
+ | `test/routes/managedAuthRoutes.test.js` | Shared-auth API route behavior and validation paths |
37
+
38
+ ## Library Tests
39
+
40
+ | File | Coverage |
41
+ | --- | --- |
42
+ | `test/lib/callLogComposer.test.js` | Call-log formatting |
43
+ | `test/lib/debugTracer.test.js` | Debug trace capture and serialization |
44
+ | `test/lib/jwt.test.js` | JWT sign and verify helpers |
45
+ | `test/lib/logger.test.js` | Logger behavior |
46
+ | `test/lib/oauth.test.js` | OAuth client and token-refresh behavior |
47
+ | `test/lib/ringcentral.test.js` | RingCentral API wrapper helpers |
48
+ | `test/lib/sharedSMSComposer.test.js` | Shared-SMS formatting |
49
+ | `test/lib/util.test.js` | Hashing, formatting, and utility helpers |
50
+
51
+ ## Model Tests
52
+
53
+ | File | Coverage |
54
+ | --- | --- |
55
+ | `test/models/models.test.js` | General Sequelize model behavior |
56
+ | `test/models/accountDataModel.test.js` | Account-data cache behavior |
57
+ | `test/models/dynamo/connectorSchema.test.js` | Dynamo-backed connector schema behavior |
58
+
59
+ ## Coverage Gaps To Be Aware Of
60
+
61
+ The current non-MCP test suite does not appear to have direct dedicated files for:
62
+
63
+ - `handlers/calldown.js`
64
+ - `handlers/disposition.js`
65
+ - `lib/authSession.js`
66
+ - `lib/encode.js`
67
+ - `lib/errorHandler.js`
68
+ - `lib/generalErrorMessage.js`
69
+ - `lib/s3ErrorLogReport.js`
70
+ - `models/callDownListModel.js`
71
+ - `models/llmSessionModel.js`
72
+ - `models/dynamo/lockSchema.js`
73
+ - `models/dynamo/noteCacheSchema.js`
package/handlers/admin.js CHANGED
@@ -8,10 +8,29 @@ const logger = require('../lib/logger');
8
8
  const { handleDatabaseError } = require('../lib/errorHandler');
9
9
 
10
10
  const CALL_AGGREGATION_GROUPS = ["Company", "CompanyNumbers", "Users", "Queues", "IVRs", "IVAs", "SharedLines", "UserGroups", "Sites", "Departments"]
11
+ const RC_EXTENSION_ENDPOINT = 'https://platform.ringcentral.com/restapi/v1.0/account/~/extension/~';
12
+
13
+ async function validateRcUserToken({ rcAccessToken }) {
14
+ if (!rcAccessToken) {
15
+ throw new Error('rcAccessToken is required');
16
+ }
17
+ const rcExtensionResponse = await axios.get(
18
+ RC_EXTENSION_ENDPOINT,
19
+ {
20
+ headers: {
21
+ Authorization: `Bearer ${rcAccessToken}`,
22
+ },
23
+ });
24
+ const extensionData = rcExtensionResponse.data ?? {};
25
+ return {
26
+ rcAccountId: extensionData?.account?.id?.toString() ?? '',
27
+ rcExtensionId: extensionData?.id?.toString() ?? ''
28
+ };
29
+ }
11
30
 
12
31
  async function validateAdminRole({ rcAccessToken }) {
13
32
  const rcExtensionResponse = await axios.get(
14
- 'https://platform.ringcentral.com/restapi/v1.0/account/~/extension/~',
33
+ RC_EXTENSION_ENDPOINT,
15
34
  {
16
35
  headers: {
17
36
  Authorization: `Bearer ${rcAccessToken}`,
@@ -489,6 +508,7 @@ async function reinitializeUserMapping({ user, hashedRcAccountId, rcExtensionLis
489
508
  }
490
509
 
491
510
  exports.validateAdminRole = validateAdminRole;
511
+ exports.validateRcUserToken = validateRcUserToken;
492
512
  exports.upsertAdminSettings = upsertAdminSettings;
493
513
  exports.getAdminSettings = getAdminSettings;
494
514
  exports.updateAdminRcTokens = updateAdminRcTokens;
@@ -497,4 +517,4 @@ exports.updateServerLoggingSettings = updateServerLoggingSettings;
497
517
  exports.getAdminReport = getAdminReport;
498
518
  exports.getUserReport = getUserReport;
499
519
  exports.getUserMapping = getUserMapping;
500
- exports.reinitializeUserMapping = reinitializeUserMapping;
520
+ exports.reinitializeUserMapping = reinitializeUserMapping;
package/handlers/auth.js CHANGED
@@ -6,6 +6,7 @@ const { RingCentral } = require('../lib/ringcentral');
6
6
  const adminCore = require('./admin');
7
7
  const { Connector } = require('../models/dynamo/connectorSchema');
8
8
  const { handleDatabaseError } = require('../lib/errorHandler');
9
+ const managedAuthCore = require('./managedAuth');
9
10
 
10
11
  async function onOAuthCallback({ platform, hostname, tokenUrl, query, hashedRcExtensionId, isFromMCP = false }) {
11
12
  const callbackUri = query.callbackUri;
@@ -77,11 +78,50 @@ async function onOAuthCallback({ platform, hostname, tokenUrl, query, hashedRcEx
77
78
  }
78
79
  }
79
80
 
80
- async function onApiKeyLogin({ platform, hostname, apiKey, proxyId, rcAccountId, hashedRcExtensionId, additionalInfo }) {
81
+ async function onApiKeyLogin({ platform, hostname, apiKey, proxyId, rcAccountId, rcExtensionId, connectorId, isPrivate, hashedRcExtensionId, additionalInfo }) {
81
82
  const platformModule = connectorRegistry.getConnector(platform);
82
- const basicAuth = platformModule.getBasicAuth({ apiKey });
83
- const { successful, platformUserInfo, returnMessage } = await platformModule.getUserInfo({ authHeader: `Basic ${basicAuth}`, hostname, platform, additionalInfo, apiKey, proxyId });
83
+ let resolvedAdditionalInfo = additionalInfo;
84
+ let resolvedApiKey = apiKey;
85
+ if (rcAccountId && rcExtensionId) {
86
+ const managedFieldDefinitions = await managedAuthCore.getManagedFieldDefinitions({ platform, connectorId, isPrivate });
87
+ const shouldFallbackToManualAuth = managedFieldDefinitions.length > 0
88
+ && await managedAuthCore.hasManagedAuthLoginFailure({ rcAccountId, platform, rcExtensionId });
89
+ const managedAuthResult = await managedAuthCore.resolveApiKeyLoginFields({
90
+ platform,
91
+ rcAccountId,
92
+ rcExtensionId,
93
+ connectorId,
94
+ isPrivate,
95
+ apiKey,
96
+ additionalInfo,
97
+ preferSubmittedValuesForManagedFields: shouldFallbackToManualAuth
98
+ });
99
+ resolvedAdditionalInfo = managedAuthResult.resolvedAdditionalInfo;
100
+ resolvedApiKey = managedAuthResult.resolvedApiKey;
101
+ const missingRequiredFieldConsts = managedAuthResult.missingRequiredFieldConsts;
102
+ if (missingRequiredFieldConsts.length > 0) {
103
+ return {
104
+ userInfo: null,
105
+ returnMessage: {
106
+ messageType: 'warning',
107
+ message: 'Missing required authentication fields.',
108
+ ttl: 3000,
109
+ missingRequiredFieldConsts
110
+ }
111
+ };
112
+ }
113
+ }
114
+ const basicAuth = platformModule.getBasicAuth({ apiKey: resolvedApiKey });
115
+ const { successful, platformUserInfo, returnMessage } = await platformModule.getUserInfo({
116
+ authHeader: `Basic ${basicAuth}`,
117
+ hostname,
118
+ platform,
119
+ additionalInfo: resolvedAdditionalInfo,
120
+ apiKey: resolvedApiKey,
121
+ proxyId
122
+ });
84
123
  if (successful) {
124
+ await managedAuthCore.clearManagedAuthLoginFailure({ rcAccountId, platform, rcExtensionId });
85
125
  let userInfo = null;
86
126
  try {
87
127
  userInfo = await saveUserInfo({
@@ -91,7 +131,7 @@ async function onApiKeyLogin({ platform, hostname, apiKey, proxyId, rcAccountId,
91
131
  proxyId,
92
132
  hashedRcExtensionId,
93
133
  rcAccountId,
94
- accessToken: platformUserInfo.overridingApiKey ?? apiKey
134
+ accessToken: platformUserInfo.overridingApiKey ?? resolvedApiKey
95
135
  });
96
136
  }
97
137
  catch (error) {
@@ -105,11 +145,12 @@ async function onApiKeyLogin({ platform, hostname, apiKey, proxyId, rcAccountId,
105
145
  returnMessage
106
146
  };
107
147
  }
108
- else {
109
- return {
110
- userInfo: null,
111
- returnMessage
112
- }
148
+ if (managedFieldDefinitions.length > 0) {
149
+ await managedAuthCore.markManagedAuthLoginFailure({ rcAccountId, platform, rcExtensionId });
150
+ }
151
+ return {
152
+ userInfo: null,
153
+ returnMessage
113
154
  }
114
155
  }
115
156
 
@@ -244,4 +285,4 @@ exports.onOAuthCallback = onOAuthCallback;
244
285
  exports.onApiKeyLogin = onApiKeyLogin;
245
286
  exports.authValidation = authValidation;
246
287
  exports.getLicenseStatus = getLicenseStatus;
247
- exports.onRingcentralOAuthCallback = onRingcentralOAuthCallback;
288
+ exports.onRingcentralOAuthCallback = onRingcentralOAuthCallback;
package/handlers/log.js CHANGED
@@ -405,11 +405,11 @@ async function updateCallLog({ jwtToken, platform, userId, incomingData, hashedA
405
405
  let pluginDataResponse = null;
406
406
  switch (pluginSetting.value.access) {
407
407
  case 'public':
408
- pluginDataResponse = await axios.get(`${process.env.DEV_PORTAL_URL}/public-api/connectors/${pluginId}/manifest?type=plugin`);
408
+ pluginDataResponse = await axios.get(`https://appconnect.labs.ringcentral.com/public-api/connectors/${pluginId}/manifest?type=plugin`);
409
409
  break;
410
410
  case 'private':
411
411
  case 'shared':
412
- pluginDataResponse = await axios.get(`${process.env.DEV_PORTAL_URL}/public-api/connectors/${pluginId}/manifest?access=internal&type=connector&accountId=${user.rcAccountId}`);
412
+ pluginDataResponse = await axios.get(`https://appconnect.labs.ringcentral.com/public-api/connectors/${pluginId}/manifest?access=internal&type=connector&accountId=${user.rcAccountId}`);
413
413
  break;
414
414
  default:
415
415
  throw new Error('Invalid plugin access');
@@ -643,11 +643,11 @@ async function createMessageLog({ platform, userId, incomingData }) {
643
643
  let pluginDataResponse = null;
644
644
  switch (pluginSetting.value.access) {
645
645
  case 'public':
646
- pluginDataResponse = await axios.get(`${process.env.DEV_PORTAL_URL}/public-api/connectors/${pluginId}/manifest?type=plugin`);
646
+ pluginDataResponse = await axios.get(`https://appconnect.labs.ringcentral.com/public-api/connectors/${pluginId}/manifest?type=plugin`);
647
647
  break;
648
648
  case 'private':
649
649
  case 'shared':
650
- pluginDataResponse = await axios.get(`${process.env.DEV_PORTAL_URL}/public-api/connectors/${pluginId}/manifest?access=internal&type=connector&accountId=${user.rcAccountId}`);
650
+ pluginDataResponse = await axios.get(`https://appconnect.labs.ringcentral.com/public-api/connectors/${pluginId}/manifest?access=internal&type=connector&accountId=${user.rcAccountId}`);
651
651
  break;
652
652
  default:
653
653
  throw new Error('Invalid plugin access');