Skip to content

Bypass Cognito hosted UI when federated IdP is configured - #37

Merged
UsamaSadiq merged 5 commits into
foss-sandboxfrom
usama/cognito-identity-provider
Jul 14, 2026
Merged

Bypass Cognito hosted UI when federated IdP is configured#37
UsamaSadiq merged 5 commits into
foss-sandboxfrom
usama/cognito-identity-provider

Conversation

@UsamaSadiq

@UsamaSadiq UsamaSadiq commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Description

MCP OAuth login on production redirects users to Cognito's native username/password page instead of the mPass QR login. The Penpot MCP server (TypeScript) has its own CognitoClient that fetches the authorization_endpoint from Cognito's OIDC discovery doc, which points at Cognito's hosted UI. In our deployment, mpass-auth-proxy sits in front of Cognito and provides the actual login page (mPass QR), but the MCP server bypasses it entirely.

This adds support for a COGNITO_UPSTREAM_AUTH_URL env var that overrides the OIDC-discovered authorization endpoint. config.ts reads the env var into upstreamAuthUrl on MonetaAuthConfig, and cognito.ts uses it (when set) as the base URL for the authorize redirect instead of the discovery document's authorization_endpoint. Token endpoint, JWKS verification, and everything else remain unchanged since mpass-auth-proxy returns real Cognito tokens.

Plane MCP is unaffected as it uses PlaneOAuthProvider (Plane's own OAuth), which already goes through mPass via ForwardAuth.

Testing

  • Set COGNITO_UPSTREAM_AUTH_URL=https://auth.<domain>/authorize and verify the MCP OAuth flow redirects to the mPass QR page
  • Verify login completes and MCP tools work after authentication
  • Verify unset COGNITO_UPSTREAM_AUTH_URL falls back to Cognito's native authorization endpoint

UsamaSadiq and others added 2 commits June 2, 2026 16:30
@UsamaSadiq
UsamaSadiq changed the base branch from foss-main to foss-sandbox July 14, 2026 08:33
@UsamaSadiq
UsamaSadiq merged commit f17bc80 into foss-sandbox Jul 14, 2026
0 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant