amplify-flutter icon indicating copy to clipboard operation
amplify-flutter copied to clipboard

Support Autofill for Authenticator Forms

Open fengkaijia opened this issue 3 years ago • 18 comments

Description

As a user, when login in to an app on an Amplify Authenticator sign-in form, I want to have my AutoFill service to fill in username and password for me. Support should include:

  • [x] Auto fill email, phone number, address, name, etc. from platform (Contact Info on iOS)
    • Implemented in #2306
  • [ ] Auto fill groups for username / password. For example, when using a password manager, populating the username from the password manager should auto populate the username and password fields.
  • [ ] Support for all platforms
    • [x] iOS
    • [x] Android
    • [ ] Web (not tested)
    • [ ] Desktop (n/a, not supported)

fengkaijia avatar Sep 28 '22 14:09 fengkaijia

Hi @fengkaijia, thanks for creating this issue. We have labeled this as a feature request and will discuss internally on how we might resolve this in the future.

fjnoyp avatar Sep 29 '22 01:09 fjnoyp

@fjnoyp & @salihgueler I'll take a look into this 😉

Just as a heads-up, this change will also require the user to make some extra changes/steps outside of the application. The user will need to create, configure and host a file under that application's domain. Official docs on this

Lorenzohidalgo avatar Oct 31 '22 14:10 Lorenzohidalgo

@Lorenzohidalgo - You are referring to setting up an Associated Domain, correct? I think this would be optional, as it would only be required to sync auto fill between a web and mobile app. This is something that could be included in documentation for the authenticator. Let me know if you are referring to something other than Associated Domains.

Jordan-Nelson avatar Oct 31 '22 14:10 Jordan-Nelson

Hi @Jordan-Nelson, exactly! The official documentation mentions that it might be needed for a good iOS experience.

Lorenzohidalgo avatar Oct 31 '22 15:10 Lorenzohidalgo

This auto closed when #2306 merged. With the changes in #2306, auto fill support has been added for most form fields. I am going to leave this open to track support for auto fill groups for username password, and to track getting this into the developer-preview branch. I will update the description to reflect this.

Thank you to @Lorenzohidalgo for PR #2306!

Jordan-Nelson avatar Mar 07 '23 17:03 Jordan-Nelson

Hello @Jordan-Nelson how can I use this? I have amplify-flutter in the latest version but I can't get autofill working neither on android or web. Thanks.

lucasoares avatar May 31 '23 13:05 lucasoares

Hey @lucasoares have you followed the steps mentioned in the readme file? https://github.com/aws-amplify/amplify-flutter/tree/main/packages/authenticator/amplify_authenticator#setting-up--troubleshooting-autofill

Lorenzohidalgo avatar May 31 '23 13:05 Lorenzohidalgo

Hey @lucasoares have you followed the steps mentioned in the readme file? https://github.com/aws-amplify/amplify-flutter/tree/main/packages/authenticator/amplify_authenticator#setting-up--troubleshooting-autofill

The step mentioned there is only different for the iOS.. For the web, for example, it should not require any additional step, right?

lucasoares avatar May 31 '23 13:05 lucasoares

Not sure about that, I've been "away" from Flutter for a while now. My recommendation would be to follow the troubleshooting tips/guide on the referenced docs. https://api.flutter.dev/flutter/material/TextField/autofillHints.html

Lorenzohidalgo avatar May 31 '23 14:05 Lorenzohidalgo

Maybe it's because I'm using custom builder with the custom forms to build my screen? I will wait for another member of amplify-flutter before starting to debug something from a third party OS code that should be working haha Thanks.

lucasoares avatar May 31 '23 14:05 lucasoares

Hi @lucasoares. How are you testing this on web and Android?

On web, Flutter will by default launch a private chrome browser in debug mode. That believe that private window won't have access to your saved usernames and passwords. If you open the same URL in a non private window, your browser should prompt you to save your username/password. Your browser should then prompt you to use those values when signing in again. Below is a screenshot of that from Firefox.

Screenshot 2023-05-31 at 10 48 03 AM

On Android, are you using a emulator or a physical device? Do you have auto fill set up on that device?

Jordan-Nelson avatar May 31 '23 14:05 Jordan-Nelson

@Jordan-Nelson To run locally I'm using a web-server device and accessing it in a logged-in Chrome browser... But I also tested it in my deployed web application accessing it directly by its domain.

I tried both 1password and Chrome's default password manager but there is no prompt for autofill:

image

My main widget:

  @override
  Widget build(BuildContext context) {
    return Authenticator(
      stringResolver: stringResolver,
      authenticatorBuilder: getAuthenticationBuilder(),
      child: MaterialApp.router(
         ...
      ),
    );
  }

My signIn form created by the getAuthenticationBuilder:

   ...
    case AuthenticatorStep.signIn:
      child = Column(
        mainAxisSize: MainAxisSize.min,
        children: [
          _logo(),
          _logoDivider(context.l10n.signInDescribed),
          SignInForm(),
          const Spacer(),
          _dontHaveAccount(context, state),
        ],
      );
      break;
  ...
  return Center(
    child: SingleChildScrollView(
      child: ConstrainedBox(
        constraints: BoxConstraints(
          maxWidth: ContainerConstants.mediumWidth,
          maxHeight: ContainerConstants.mediumHeight,
        ),
        child: Padding(
          padding: EdgeInsets.symmetric(vertical: containerPadding),
          child: Container(
            decoration: BoxDecoration(
              borderRadius: BorderRadius.circular(10),
              border: Border.all(),
            ),
            child: Padding(
              padding: padding,
              child: child,
            ),
          ),
        ),
      ),
    ),
  );

lucasoares avatar May 31 '23 15:05 lucasoares

any updates on that?

i switched from cognito hosted ui to amplify-authenticator in my angular application. Login and Signup works fine, but passwords are not stored/autofilled as it was with the hosted ui. It's bit of a bad user experience currently

simon1389 avatar Aug 06 '24 19:08 simon1389

@simon1389 - Are you using Amplify JS or Amplify Flutter?

Jordan-Nelson avatar Aug 07 '24 17:08 Jordan-Nelson

@simon1389 - Are you using Amplify JS or Amplify Flutter?

Amplify JS

simon1389 avatar Aug 07 '24 19:08 simon1389

Can you open an issue at https://github.com/aws-amplify/amplify-ui? aws-amplify/amplify-ui is the repository for the Amplify JS UI components.

Jordan-Nelson avatar Aug 08 '24 14:08 Jordan-Nelson

Can you open an issue at https://github.com/aws-amplify/amplify-ui? aws-amplify/amplify-ui is the repository for the Amplify JS UI components.

i created an issue, and with help of @jacoblogan we found the root cause :)

https://github.com/aws-amplify/amplify-ui/issues/5547

simon1389 avatar Aug 08 '24 19:08 simon1389

Great, thanks. We will continue to use this issue to track support for the Amplify Flutter authenticator.

Jordan-Nelson avatar Aug 08 '24 19:08 Jordan-Nelson