Skip to content

Persist and restore in-progress custom auth challenge session across app termination on iOS #4205

Open

Description

@AnnaAlexandra-Trove

Is your feature request related to a problem? Please describe.

When using Amplify Auth for Swift with a Cognito custom auth flow, a user may start sign-in, receive a OTP by email, leave the app to retrieve the OTP, and then return to complete sign-in with confirmSignIn.

This works while the app process remains alive. However, if iOS terminates the app before the user returns, Amplify loses the in-progress custom challenge state. After relaunch, confirmSignIn can no longer continue the existing Cognito challenge because the internal session/challenge state is gone, even though the OTP is still valid server-side. This causes sign-in to fail and forces the user to restart the auth flow and send a new OTP.

Describe the solution you'd like

It would be great if the Amplify library could persist and restore in-progress session/state for Cognito custom auth flows.

When a signIn response returns .confirmSignInWithCustomChallenge, Amplify should securely persist the required pending session/state in the keychain. Then on app relaunch, Amplify should be able to restore that pending state so a subsequent call to confirmSignIn can continue the same Cognito session instead of failing due to missing in-memory state.

Describe alternatives you've considered

Alternatively, Amplify could expose an API that allows apps to retrieve and later restore the current custom auth session/challenge state. This would let us securely persist the required state ourselves, and restore it after app relaunch before calling confirmSignIn.

Is the feature request related to any of the existing Amplify categories?

Auth

Additional context

No response

Activity

  1. jvh-aws commented on May 5, 2026

    @jvh-aws
    Contributor

    Thank you for the feature request. We'll track this for consideration and update here.

  2. github-actions commented on May 5, 2026

    @github-actions
    Contributor

    This has been identified as a feature request. If this feature is important to you, we strongly encourage you to give a 👍 reaction on the request. This helps us prioritize new features most important to you. Thank you!

  3. PragyaM commented on Jul 8, 2026

    @PragyaM

    Any updates on whether/when this might get actioned?

  4. harsh62 commented on Jul 14, 2026

    @harsh62
    Contributor

    @PragyaM We are working on a prioritizing this internally and trying to see if a design is really feasible. We are also trying to figure out what the API surface is gonna look like.

    We will provide an update for the feature as soon as we can.

  5. added
    authIssues related to the Auth category
    on Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    authIssues related to the Auth categoryfeature-requestRequest a new feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions