aws-amplify / aws-amplify/docs
Clarity on How to use Custom_Flow Amplify V6 + Angular
- Dominant language
- MDX
- Stars
- 506
- Forks
- 1.1k
- Avg merge
- 3h 14m
- Merged PRs (30d)
- 1
Description
**Describe the content issue**:
I have a custom flow using create,define and verify auth challenge lambdas, wich returns a sms message.
I understand the following function:
```typescript
export async function handleSignIn(username: string) {
const challengeResponse = 'the answer for the challenge';
try {
const { nextStep } = await signIn({
username,
options: {
authFlowType: 'CUSTOM_WITHOUT_SRP',
},
});
if (nextStep.signInStep === 'CONFIRM_SIGN_IN_WITH_CUSTOM_CHALLENGE') {
try {
// to send the answer of the custom challenge
const output = await confirmSignIn({ challengeResponse });
console.log(output);
} catch (err) {
console.log(err);
}
}
} catch (err) {
console.log(err);
}
}
```
The issue is that signIn method (auth.html) activates the lambda that send me the sms message, but that message that is a random 6 digit number I have to write it in another page (challenge.html) and then submit the 6 digit-number.
So how it is expected to sbumit the challenge that is in the same function, and is activated just when signIn method is called?
` const challengeResponse = 'the answer for the challenge';`
I try to use confirmSignIn in another function, but it didn't work as it need to be invoke after signIn method.
Before I was Using amplify V5 and the flow was like this:
First I used this function in my login page, and it returns to me an sms message
```typescript
async login(username: string) {
this.cognitoUser = await Auth.signIn(username);
}
```
then in my challenge page I could answer with the code redeived by the sms message and use this function:
```typescript
public async answerCustomChallenge(answer: string) {
this.cognitoUser = await Auth.sendCustomChallengeAnswer(
this.cognitoUser,
answer
);
return this.isAuthenticated();
}
```
How can I make that same flow but with V6 amplify ?
**URL page where content issue is**:
https://docs.amplify.aws/gen1/angular/build-a-backend/auth/switch-auth/
Contributor guide
Assessment
This issue has not been assessed yet.