Amplify UI

Configuration

How to setup and configure your Authenticator component.

Wait!

Did you follow the quick start instructions to set up the Authenticator first?

Initial State

By default, unauthenticated users are redirected to the Sign In flow. You can explicitly redirect to Sign Up or Forgot Password:

Login Mechanisms

Zero Configuration

Whether the user is able to sign in with their username, phone number or email is automatically inferred from the current Amplify configuration.

This determines which login mechanism the Authenticator for Swift uses, no other configuration is supported.

Sign Up Attributes

Zero Configuration

The Authenticator automatically infers signUpAttributes from amplify pull, but can be explicitly defined as seen below.

The Authenticator automatically renders most Cognito User Pools attributes, with the exception of address, gender, locale, picture, updated_at, and zoneinfo. Because these are often app-specific, they can be customized via Sign Up fields.

By default, the Authenticator will still require any attributes required for verification, such as email, even if signUpAttributes is empty:

Authenticator { _ in
    Text("You are logged in!")
}
Authenticator { _ in
    Text("You are logged in!")
}
.signUpFields([
    .username(),
    .password(),
    .confirmPassword(),
    .email(),
    .phoneNumber(),
    .address(),
    .birthDate(),
    .gender(),
    .givenName(),
    .middleName(),
    .familyName(),
    .name(),
    .nickname(),
    .preferredUsername(),
    .profile(),
    .website()
])

Hide Sign Up Button

The Authenticator has an option to hide the Sign Up link button that appears in the Sign In view:

Authenticator { _ in
    Text("You are logged in!")
}
.hidesSignUpButton()

TOTP Issuer

The TOTP issuer is the name that will be shown in TOTP applications preceding the account name. In most cases, this should be the name of your app. For example, if your app is called "My App", your user will see "My App" - "username" in their TOTP app. This can be customized by adding the totpOptions argument to the Authenticator component with a value for issuer.

Note: Unless changed, the default issuer is the application name retrieved from the project configuration. The key for this value is CFBundleDisplayName on iOS found in info.plist.

Authenticator(totpOptions: .init(issuer: "My App")) { _ in
    Text("Signed In Content")
}

Amplify open source software, documentation and community are supported by Amazon Web Services.

© 2024 Amazon Web Services, Inc. and its affiliates. All rights reserved. View the site terms and privacy policy.

Flutter and the related logo are trademarks of Google LLC. We are not endorsed by or affiliated with Google LLC.