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

Customizing authenticator #5781

Open
vipinkashyap opened this issue Dec 17, 2024 · 10 comments
Open

Customizing authenticator #5781

vipinkashyap opened this issue Dec 17, 2024 · 10 comments
Assignees
Labels
Authenticator Issues related to the Authenticator UI Component question A question about the Amplify Flutter libraries

Comments

@vipinkashyap
Copy link

vipinkashyap commented Dec 17, 2024

I have email and phone login setup on my cognito group. The authenticator widget shows both ways of logging in email and phone.

I only want to show phone login and signup . How do i do this ? How do i customize the authenticator? This is a common use case how would you suggest i go about this ?

I dont want to disturb any cognito settings . Im mostly looking for a way to do this on the front end. Because it looks like i cant edit the aws cognito config to only allow for phone auth.

@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 17, 2024
@ekjotmultani
Copy link
Member

ekjotmultani commented Dec 17, 2024

Hi @vipinkashyap, thank you for your question. Have you set up phone as the main log in property in the Amplify backend?. For further reference on UI customization for Authenticator, please see here.

@github-actions github-actions bot removed the pending-maintainer-response Pending response from a maintainer of this repository label Dec 17, 2024
@ekjotmultani ekjotmultani self-assigned this Dec 17, 2024
@ekjotmultani ekjotmultani added the question A question about the Amplify Flutter libraries label Dec 17, 2024
@github-actions github-actions bot removed the pending-triage This issue is in the backlog of issues to triage label Dec 17, 2024
@vipinkashyap
Copy link
Author

vipinkashyap commented Dec 17, 2024

Hi @ekjotmultani

This is the aws cognito config. Ive already read the documentation on authenticator and it seems like either this use case is not discussed or missed. Let me know what other information you need.

image

For verifying
image

For signup
image

@github-actions github-actions bot added the pending-maintainer-response Pending response from a maintainer of this repository label Dec 17, 2024
@ekjotmultani
Copy link
Member

Hi @vipinkashyap, thank you for the added information. Could you share your backend.ts file from your amplify app?

@github-actions github-actions bot removed the pending-maintainer-response Pending response from a maintainer of this repository label Dec 18, 2024
@vipinkashyap
Copy link
Author

vipinkashyap commented Dec 18, 2024

Im not using amplify for my backend this is a amplify gen1 flutter app using a custom backend. I can share my awsconfiguration with you if youd like with pii hidden.

@github-actions github-actions bot added the pending-maintainer-response Pending response from a maintainer of this repository label Dec 18, 2024
@ekjotmultani
Copy link
Member

Hi @vipinkashyap, I would appreciate that, it will help us investigate the issue and try to find a solution

@github-actions github-actions bot removed the pending-maintainer-response Pending response from a maintainer of this repository label Dec 18, 2024
@ekjotmultani ekjotmultani added the Authenticator Issues related to the Authenticator UI Component label Dec 18, 2024
@vipinkashyap
Copy link
Author

Heres the config @ekjotmultani

{
  "UserAgent": "aws-amplify-cli/2.0",
  "Version": "1.0",
  "storage": {
    "plugins": {
      "awsS3StoragePlugin": {
        "bucket": "test-bucket-name",
        "region": "us-west-2"
      }
    }
  },
  "auth": {
    "plugins": {
      "awsCognitoAuthPlugin": {
        "UserAgent": "aws-amplify-cli/0.1.0",
        "Version": "0.1.0",
        "IdentityManager": {
          "Default": {}
        },
        "CredentialsProvider": {
          "CognitoIdentity": {
            "Default": {
              "PoolId": "us-west-2:*****-****-***-****-*********",
              "Region": "us-west-2"
            }
          }
        },
        "CognitoUserPool": {
          "Default": {
            "PoolId": "us-west-2_******",
            "AppClientId": "********",
            "AppClientSecret": "********",
            "Region": "us-west-2"
          }
        },
        "Auth": {
          "Default": {
            "authenticationFlowType": "USER_SRP_AUTH",
            "socialProviders": [],
            "usernameAttributes": [
              "username",
              "email",
              "phone_number"
            ],
            "signupAttributes": [
              "username",
              "name",
              "middle_name",
              "family_name",
              "email",
              "phone_number"
            ],
            "passwordProtectionSettings": {
              "passwordPolicyMinLength": 8,
              "passwordPolicyCharacters": []
            },
            "mfaConfiguration": "OPTIONAL",
            "mfaTypes": [
              "SMS",
              "TOTP"
            ],
            "verificationMechanisms": [
              "EMAIL"
            ]
          }
        },
        "S3TransferUtility": {
          "Default": {
            "Bucket": "test-bucket-name",
            "Region": "us-west-2"
          }
        }
      }
    }
  },
  "analytics": {
    "plugins": {
      "awsPinpointAnalyticsPlugin": {
        "pinpointAnalytics": {
          "appId": "**********",
          "region": "us-west-2"
        },
        "pinpointTargeting": {
          "region": "us-west-2"
        }
      }
    }
  },
  "api": {
    "plugins": {
      "awsAPIPlugin": {
        "Test API": {
          "endpointType": "GraphQL",
          "endpoint": "https://*************.appsync-api.us-west-2.amazonaws.com/graphql",
          "region": "us-west-2",
          "authorizationType": "AMAZON_COGNITO_USER_POOLS"
        }
      }
    }
  }
}

@github-actions github-actions bot added the pending-maintainer-response Pending response from a maintainer of this repository label Dec 20, 2024
@vipinkashyap
Copy link
Author

Hi, we need some kind of solution to this. Please let me know if this config allows for authenticator customization as needed(only restrict to phone login)

@ekjotmultani
Copy link
Member

Hi @vipinkashyap, sorry for the delayed response, we actually did investigate this and find that there is no easy way to make this change solely on the UI side for the plug and play Authenticator component without changing the Cognito user attribute field, which as you say should not be disturbed once already set.

I will mark this as a feature request to allow for custom sign in fields on Authenticator, as we have custom sign up fields but not for sign in. If you would like to take a stab at implementing your own class for this it would be an extension of SignInFormField, however since I've already tracked this it may be better to wait for our official release of it.

If phone sign in only is a hard requirement then it may be better to implement a custom UI flow using the calls outlined here. I apologize for the disappointing answer but hopefully I can get a pr in for this feature relatively soon. Please let me know if I can help with anything else!

@github-actions github-actions bot removed the pending-maintainer-response Pending response from a maintainer of this repository label Dec 24, 2024
@vipinkashyap
Copy link
Author

Hi @ekjotmultani ,

I think there is a provision to do this . I figured it out by mistake but it would be great if you could add it as part of documentation on customizing authenticator

You could edit the amplifyconfiguration.dart file
image

Post removing attributes => Authenticator updates the UI itself
image

Pre removing attributes
image

Do you think this is an acceptable solution ?

@github-actions github-actions bot added the pending-maintainer-response Pending response from a maintainer of this repository label Dec 24, 2024
@ekjotmultani
Copy link
Member

Hi @vipinkashyap, this does work although we don't generally recommend it since we don't want users to edit the generated files from Amplify in case it causes other errors. However, I am happy that it seems to have worked out in this case, I will still keep the feature request for customizing sign in more robustly through Authenticator UI as a result of this issue but for now this is a working solution as long as sign in is working as intended!

@github-actions github-actions bot removed the pending-maintainer-response Pending response from a maintainer of this repository label Dec 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Authenticator Issues related to the Authenticator UI Component question A question about the Amplify Flutter libraries
Projects
None yet
Development

No branches or pull requests

2 participants