Skip to content

feat(oauth): PKCE exemption for allowlisted confidential clients (Copilot Studio) - #884

Merged
keysersoft merged 2 commits into
mainfrom
keysersoft/copilot-studio-pkce-exempt
Oct 5, 2026
Merged

keysersoft merged 2 commits into
mainfrom
keysersoft/copilot-studio-pkce-exempt

Conversation

@keysersoft

Copy link
Copy Markdown
Contributor

Power Platform connectors, which is what a Microsoft Copilot Studio certified MCP connector is, use a plain OAuth 2.0 authorization code flow with a client secret and cannot send PKCE. Our /authorize requires S256, so such a connector could never sign in.

  • OAUTH_PKCE_EXEMPT_CLIENT_IDS (comma-separated) lists clients that may omit the challenge.
  • The exemption holds only while the client is confidential: client_secret_basic/client_secret_post with a stored secret. The token endpoint then refuses the code without the secret, and the code stays bound to the registered redirect URI.
  • A listed client that does send a challenge is validated as before; a method without a challenge is still rejected.
  • Unlisted clients (all DCR clients) take the old path and never trigger a DB lookup. Lookup errors fail closed.
  • Wired into docker-compose.cloud.yml (default empty) and documented in .env.example.

Tests: 9 new cases in authorize-pkce.middleware.spec.ts; src/auth + src/mcp-server 563/563 green.

Power Platform connectors (Microsoft Copilot Studio) run a plain OAuth 2.0
authorization code flow with a client secret and cannot send PKCE, so the
S256 requirement on /authorize locked them out. OAUTH_PKCE_EXEMPT_CLIENT_IDS
names the clients that may omit the challenge; the exemption only applies
while the registration is confidential (client_secret_basic/post with a
stored secret), so the token endpoint still refuses the code without the
secret. Unlisted clients, including every DCR client, are unchanged and
never cause a database lookup.
@keysersoft
keysersoft enabled auto-merge (squash) October 5, 2026 11:58
@keysersoft
keysersoft merged commit 39a868c into main Oct 5, 2026
13 checks passed
@keysersoft
keysersoft deleted the keysersoft/copilot-studio-pkce-exempt branch October 5, 2026 12:01
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant