Skip to content

How to login with otp code, customized flow #5787

Open
@vkumarvs

Description

@vkumarvs

Description

Hello everyone,
I would really appreciate if someone can help me out here.

Does amplify flutter auth package supports login with otp as well as password. I want to customize my frontend Auth UI screens, my flow is something like this:
signUp --- using email and password, by sending code to confirm the email.
signIn --> After email verification user can choose to either log in by sending OTP (no TOTP) or by entering password.

My login using password works fine. however I tried to find auth support to do with otp, I couldnt locate any way to do so (Amplify.Auth.).

Please point me out in right direction.

Debug:
I have enabled a managed UI that cognito provide, which helped to verify that my cognito configuration is correct. By using cognito provide link i can verify that my login using password, OTP or even passkeys works fine.

I am using below packages.

amplify_flutter: ^2.5.0
amplify_auth_cognito: ^2.5.0
amplify_authenticator: ^2.3.1
amplify_api: ^2.5.0
amplify_storage_s3: ^2.5.1

`const backend = defineBackend({
auth,
storage,
//data,
});

const { cfnResources } = backend.auth.resources;
const { cfnUserPool, cfnUserPoolClient } = cfnResources;
configureAuthOverrides();

/**

  • Configure Auth Overrides
    */
    function configureAuthOverrides() {
    // Update User Pool properties
    cfnUserPool.addPropertyOverride(
    'Policies.SignInPolicy.AllowedFirstAuthFactors',
    ['PASSWORD', 'WEB_AUTHN', 'EMAIL_OTP']
    );

cfnUserPool.addPropertyOverride('WebAuthnUserVerification', 'preferred');

// Update User Pool Client properties
cfnUserPoolClient.explicitAuthFlows = [
'ALLOW_REFRESH_TOKEN_AUTH',
'ALLOW_USER_AUTH',
'ALLOW_USER_SRP_AUTH',
];
...`

Categories

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

Steps to Reproduce

Customized screens using amplify.Auth provided functions and Autneticator.

Screenshots

Managed link login works fine

Screenshot 2024-12-23 at 10 03 33 PM

Platforms

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

Flutter Version

3.24.4

Amplify Flutter Version

amplify_flutter: ^2.5.0

Deployment Method

Amplify Gen 2

Schema

No response

Metadata

Metadata

Assignees

Labels

authIssues related to the Auth CategoryquestionA question about the Amplify Flutter libraries

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions