Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

fix(microsoft-copilot): Microsoft 365 Copilot connections no longer stop working after about 90 minutes (#16221)

Bartosz Majewski6585d9ba4849
diff --git a/bun.lock b/bun.lock
index d07b75f875c..6b77f877e17 100644
--- a/bun.lock
+++ b/bun.lock
@@ -5798,7 +5798,7 @@
},
"packages/pieces/community/microsoft-copilot": {
"name": "@activepieces/piece-microsoft-copilot",
- "version": "0.2.1",
+ "version": "0.2.2",
"dependencies": {
"@activepieces/core-piece-types": "workspace:*",
"@activepieces/core-utils": "workspace:*",
@@ -5809,6 +5809,7 @@
},
"devDependencies": {
"tslib": "2.6.2",
+ "vitest": "3.2.6",
},
},
"packages/pieces/community/microsoft-dynamics-365-business-central": {
diff --git a/packages/pieces/community/microsoft-copilot/package.json b/packages/pieces/community/microsoft-copilot/package.json
index 836c7b34202..493df23f8ef 100644
--- a/packages/pieces/community/microsoft-copilot/package.json
+++ b/packages/pieces/community/microsoft-copilot/package.json
@@ -1,6 +1,6 @@
{
"name": "@activepieces/piece-microsoft-copilot",
- "version": "0.2.1",
+ "version": "0.2.2",
"type": "commonjs",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
@@ -13,11 +13,13 @@
"@activepieces/core-utils": "workspace:*"
},
"devDependencies": {
- "tslib": "2.6.2"
+ "tslib": "2.6.2",
+ "vitest": "3.2.6"
},
"scripts": {
"build": "tsc -p tsconfig.lib.json && cp package.json dist/",
"bundle": "node ../../../../dist/packages/cli/src/index.js pieces bundle",
- "lint": "eslint 'src/**/*.ts'"
+ "lint": "eslint 'src/**/*.ts'",
+ "test": "vitest run"
}
}
diff --git a/packages/pieces/community/microsoft-copilot/src/lib/common/auth.ts b/packages/pieces/community/microsoft-copilot/src/lib/common/auth.ts
index d51a162df6a..c992948edb4 100644
--- a/packages/pieces/community/microsoft-copilot/src/lib/common/auth.ts
+++ b/packages/pieces/community/microsoft-copilot/src/lib/common/auth.ts
@@ -39,6 +39,7 @@ export const microsoft365CopilotAuth = PieceAuth.OAuth2({
'openid',
'email',
'profile',
+ 'offline_access',
],
prompt: 'omit',
});
diff --git a/packages/pieces/community/microsoft-copilot/test/auth.test.ts b/packages/pieces/community/microsoft-copilot/test/auth.test.ts
new file mode 100644
index 00000000000..d97759dcf41
--- /dev/null
+++ b/packages/pieces/community/microsoft-copilot/test/auth.test.ts
@@ -0,0 +1,8 @@
+import { describe, expect, test } from 'vitest';
+import { microsoft365CopilotAuth } from '../src/lib/common/auth';
+
+describe('microsoft365CopilotAuth', () => {
+ test('requests offline_access so Microsoft issues a refresh token', () => {
+ expect(microsoft365CopilotAuth.scope).toContain('offline_access');
+ });
+});
diff --git a/packages/pieces/community/microsoft-copilot/vitest.config.ts b/packages/pieces/community/microsoft-copilot/vitest.config.ts
new file mode 100644
index 00000000000..d87fc4a6954
--- /dev/null
+++ b/packages/pieces/community/microsoft-copilot/vitest.config.ts
@@ -0,0 +1,8 @@
+import { defineConfig } from 'vitest/config'
+
+export default defineConfig({
+ test: {
+ globals: true,
+ environment: 'node',
+ },
+})