Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Amplify Does Not Use Endpoint for Cognito Auth Calls #5784

Open
3 of 14 tasks
mozakassab opened this issue Dec 23, 2024 · 6 comments
Open
3 of 14 tasks

Amplify Does Not Use Endpoint for Cognito Auth Calls #5784

mozakassab opened this issue Dec 23, 2024 · 6 comments
Assignees
Labels
auth Issues related to the Auth Category feature-request A request for a new feature or an enhancement to an existing API or category. pending-maintainer-response Pending response from a maintainer of this repository question A question about the Amplify Flutter libraries

Comments

@mozakassab
Copy link

Description

When configuring Amplify in a Flutter application with existing resources and specifying an Endpoint for CognitoUserPool, the SDK does not route Cognito calls through the provided endpoint. This behavior is unexpected, and was working before with v1.
Here's an example of the configuration passed for existing resources:

String amplifyconfig = ''' {
  "UserAgent": "aws-amplify-cli/2.0",
  "Version": "1.0",
  "auth": {
    "plugins": {
      "awsCognitoAuthPlugin": {
        "IdentityManager": {
          "Default": {}
        },
        "CognitoUserPool": {
          "Default": {
            "PoolId": "${EnvVariables.cognitoUserPoolID.value}",
            "AppClientId": "${EnvVariables.cognitoAppClientID.value}",
            "Region": "${EnvVariables.awsRegion.value}",
            "Endpoint": "${EnvVariables.awsCognitoEndpoint.value}"
          }
        },
        "Auth": {
          "Default": {
            "authenticationFlowType": "CUSTOM_AUTH"
          }
        }
      }
    }
  }
}''';

Categories

  • Analytics
  • API (REST)
  • API (GraphQL)
  • Auth
  • Authenticator
  • DataStore
  • Notifications (Push)
  • Storage

Steps to Reproduce

  1. Configure Amplify with existing resources, and specify an endpoint for CognitoUserPool:
String amplifyconfig = ''' {
  "UserAgent": "aws-amplify-cli/2.0",
  "Version": "1.0",
  "auth": {
    "plugins": {
      "awsCognitoAuthPlugin": {
        "IdentityManager": {
          "Default": {}
        },
        "CognitoUserPool": {
          "Default": {
            "PoolId": "${EnvVariables.cognitoUserPoolID.value}",
            "AppClientId": "${EnvVariables.cognitoAppClientID.value}",
            "Region": "${EnvVariables.awsRegion.value}",
            "Endpoint": "${EnvVariables.awsCognitoEndpoint.value}"
          }
        },
        "Auth": {
          "Default": {
            "authenticationFlowType": "CUSTOM_AUTH"
          }
        }
      }
    }
  }
}''';
  1. Add Cognito Auth plugin:
Amplify.addPlugin(
        AmplifyAuthCognito(),
      );
  1. Configure Amplify:
Amplify.configure(amplifyconfig);
  1. Try calling any Cognito method and check the network logs (Request is not made through the specified Endpoint):
Amplify.Auth.getPlugin(AmplifyAuthCognito.pluginKey).signUp(
        username: username,
        password: password
        );

Screenshots

No response

Platforms

  • iOS
  • Android
  • Web
  • macOS
  • Windows
  • Linux

Flutter Version

3.27.1

Amplify Flutter Version

2.5.0

Deployment Method

Custom Pipeline

Schema

No response

@github-actions github-actions bot added pending-triage This issue is in the backlog of issues to triage pending-maintainer-response Pending response from a maintainer of this repository labels Dec 23, 2024
@ekjotmultani
Copy link
Member

Hi @mozakassab, thank you for your detail in describing the issue. We will investigate and get back to you when we have an update

@github-actions github-actions bot removed the pending-maintainer-response Pending response from a maintainer of this repository label Dec 23, 2024
@ekjotmultani ekjotmultani self-assigned this Dec 23, 2024
@ekjotmultani ekjotmultani added auth Issues related to the Auth Category to-be-reproduced Issues that have not been reproduced yet, but have reproduction steps provided labels Dec 23, 2024
@ekjotmultani
Copy link
Member

Hi @mozakassab, I looked into it and it seems that, unfortunately, a custom endpoint to route Cognito calls through in the AWSCognitoPlugin is no longer supported as of Gen 2. Is this something that is critical to your application?

@ekjotmultani ekjotmultani added feature-parity A request for a feature that is fully or partially available on another platform (JS, iOS, Android) and removed to-be-reproduced Issues that have not been reproduced yet, but have reproduction steps provided pending-triage This issue is in the backlog of issues to triage labels Jan 3, 2025
@mozakassab
Copy link
Author

Hi @ekjotmultani ,thank you for the update. Yes, configuring a custom endpoint is critical for our application. Could you please clarify why this feature is no longer supported in Gen 2? Were there any release notes regarding the discontinuation of this support, and are there any plans to reintroduce the custom endpoint configuration in the future?

@github-actions github-actions bot added the pending-maintainer-response Pending response from a maintainer of this repository label Jan 3, 2025
@ekjotmultani ekjotmultani added question A question about the Amplify Flutter libraries feature-request A request for a new feature or an enhancement to an existing API or category. and removed feature-parity A request for a feature that is fully or partially available on another platform (JS, iOS, Android) labels Jan 3, 2025
@ekjotmultani
Copy link
Member

Hi @mozakassab , my apologies that this is such an impact to your application. I am looking into a workaround or some type of solution for this in the meantime.

@github-actions github-actions bot removed the pending-maintainer-response Pending response from a maintainer of this repository label Jan 7, 2025
@ekjotmultani
Copy link
Member

ekjotmultani commented Jan 8, 2025

Hi @mozakassab, can you try adding
"OAuth": { "WebDomain": "[YOUR COGNITO DOMAIN ]" } after the authenticationFlowType key, under Default

Also to double check, is the custom domain set up with no problems in Cognito for the userpool you are using?

@mozakassab
Copy link
Author

Hi @ekjotmultani, thanks for the suggestion! Unfortunately, adding "OAuth": { "WebDomain": "[YOUR COGNITO DOMAIN]" } after the authenticationFlowType key doesn’t solve the issue.

This configuration is used for managed login pages and social logins, which isn’t what I’m trying to do.
What I’m looking for is a way to ensure all Cognito SDK calls are routed through a custom endpoint.

Thanks again!

@github-actions github-actions bot added the pending-maintainer-response Pending response from a maintainer of this repository label Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auth Issues related to the Auth Category feature-request A request for a new feature or an enhancement to an existing API or category. pending-maintainer-response Pending response from a maintainer of this repository question A question about the Amplify Flutter libraries
Projects
None yet
Development

No branches or pull requests

2 participants