user28510212
user28510212

Reputation: 1

AWS Custom Authentication Challenge - DefineAuthChallenge is not getting re-triggered

We are trying to trigger custom auth challenge from the React code with challenge SRP_A.

Define custom challenge gets triggered and challenge name is updated with Password verifier and post this define custom challenge does not gets triggered which further fails to update the challenge to CUSTOM_AUTH and the lambda fails to call the Create auth challenge and verify auth challenge

Below is the code snippet for the define auth challenge -

if (event.request.session.length == 1 &&
        event.request.session[0].challengeName == 'SRP_A') {
          console.log("Session State: SRP_A ", JSON.stringify(event.request.session));
          event.response.issueTokens = false;
          event.response.failAuthentication = false;
          event.response.challengeName = 'PASSWORD_VERIFIER';
    } else if (event.request.session.length == 2 &&
        event.request.session[1].challengeName == 'PASSWORD_VERIFIER' &&
        event.request.session[1].challengeResult == true) {
          console.log("Session State: PASSWORD_VERIFIER ", JSON.stringify(event.request.session));
          event.response.issueTokens = false;
          event.response.failAuthentication = false;
          event.response.challengeName = 'CUSTOM_CHALLENGE';
    } else if (event.request.session.length == 3 &&
        event.request.session[2].challengeName == 'CUSTOM_CHALLENGE' &&
        event.request.session[2].challengeResult == true) {
          console.log("Session State: CUSTOM_CHALLENGE ", JSON.stringify(event.request.session));
          event.response.issueTokens = true;
          event.response.failAuthentication = false;
    } else {
      console.log("Session State: else ", JSON.stringify(event.request.session));
        event.response.issueTokens = false;
        event.response.failAuthentication = true;
    }
    return event;

I am expecting that the Define auth challenge should be re-triggered, and update the challenge name with CUSTOM_AUTH post which create auth challenge gets triggered

Upvotes: 0

Views: 29

Answers (0)

Related Questions