Ability to resume authentication flow (v6) #12810
Labels
Auth
Related to Auth components/category
need-product-input
Needs non-technical requirements or direction to proceed
VP
Version parity issues between v5 and v6
Is this related to a new or existing framework?
React
Is this related to a new or existing API?
Authentication
Is this related to another service?
No response
Describe the feature you'd like to request
We're looking to upgrade from Amplify v5 to v6, but currently have sign in custom challenge work around which doesn't look possible with the new v6 API.
We have a requirement for custom sign in challenge which involves redirecting the user away from the login page to an external MFA page, and back, to which we can then perform the custom challenge response. We've solved this in Amplify v5 by persisting most of the
CognitoUser
data in session storage and hydrating the client after the redirect back to the login page. Whilst this isn't ideal, it allows us to resume the session and perform the custom challenge response to successfully sign in.In v5, this is possible because the
sendCustomChallengeAnswer
function takes the cognito user session as an argument, allowing us to re-create theCognitoUser
object and pass that in manually. Now in v6, I believe this is handled automatically in memory and the concept ofCognitoUser
has been replaced and is no longer passed around manually.Describe the solution you'd like
A possible solution to this in v6 could be to expose the ability to read and hydrate the sign in store manually. This would allow us to initiate the sign in store with the persisted values after an external redirect.
Describe alternatives you've considered
I've tested a proof of concept locally which exposes the sign in store and related functions to the consumer.
By calling the
setActiveSignInState
function with the serialised value fromsignInStore.getState()
that was persisted in session storage, it allowed the ability to continue the authentication session, callconfirmSignIn
and successfully sign in.Additional context
For additional context, we also have a pre-existing issue open which describes the v5 issue/solution in better detail. The resolution of this in v6 will likely allow us to close that older issue once we've upgraded.
Let me know if you need any additional context. We're looking forward to upgrading to v6 - the new API and improved types are looking great.
Is this something that you'd be interested in working on?
The text was updated successfully, but these errors were encountered: