Bypass Cognito hosted UI when federated IdP is configured - #37
Merged
Conversation
Foss sandbox
Signed-off-by: Usama Sadiq <usama.sadiq@arbisoft.com>
…exchange Signed-off-by: Usama Sadiq <usama.sadiq@arbisoft.com>
Signed-off-by: Usama Sadiq <usama.sadiq@arbisoft.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
CognitoClientthat fetches theauthorization_endpointfrom 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_URLenv var that overrides the OIDC-discovered authorization endpoint.config.tsreads the env var intoupstreamAuthUrlonMonetaAuthConfig, andcognito.tsuses it (when set) as the base URL for the authorize redirect instead of the discovery document'sauthorization_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
COGNITO_UPSTREAM_AUTH_URL=https://auth.<domain>/authorizeand verify the MCP OAuth flow redirects to the mPass QR pageCOGNITO_UPSTREAM_AUTH_URLfalls back to Cognito's native authorization endpoint