Skip to content

Commit

Permalink
Handle totp mfa on sign in
Browse files Browse the repository at this point in the history
  • Loading branch information
danielholmes committed Feb 1, 2024
1 parent 16c97c3 commit 25d2bf3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dhau/react-aws-cognito",
"version": "0.0.12",
"version": "0.0.13",
"type": "module",
"sideEffects": false,
"description": "Context and hooks to manage an AWS Cognito authenticated user in React.",
Expand Down
7 changes: 7 additions & 0 deletions src/model/sign-in.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ type SignInResult =
}
| {
readonly type: "newPassword";
}
| {
readonly type: "mfa";
readonly user: CognitoUser;
};

async function signIn<TUser>(
Expand Down Expand Up @@ -52,6 +56,9 @@ async function signIn<TUser>(
});
resolve({ type: "newPassword" });
},
totpRequired() {
resolve({ type: "mfa", user });
},
});
});
if (result.type === "success") {
Expand Down

0 comments on commit 25d2bf3

Please sign in to comment.