Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

142
Vistas
Need help for cognito authentication flow with MFA to remember the device while challenging for MFA

I am using aws cognito service for authentication, followed https://github.com/aws-amplify/amplify-js/tree/master/packages/amazon-cognito-identity-js this documentation.

My login flow is something like this:

import {AuthenticationDetails,CognitoUser,CognitoUserPool} from 'amazon-cognito-identity-js';

const authenticationData = {
  Username: <username>,
  Password: <password>
};
const authenticationDetails = new AuthenticationDetails(
  authenticationData
);

const userData = {
  Username: <username>,
  Pool: <userPoolId>,
};

const cognitoUser = new CognitoUser(userData);

cognitoUser.authenticateUser(authenticationDetails, {
  onSuccess: (result) => {
    const accessToken = result.getAccessToken().getJwtToken();
    console.log('access token --> ', accessToken);

  },
  onFailure: (err) => {
    console.log("error",err.message);
  },
  mfaRequired: function (codeDeliveryDetails) {
    var verificationCode = prompt('Please input verification code', '');
    cognitoUser.sendMFACode(verificationCode, this);
  },

})

I've already created one AWS Cognito UserPool and the enabled MFA for the same. enter image description here

In signin flow is working and the user is authenticated by multi-factor-authentication and I'm getting the access token.

But now I want not to verify mfa for the same device multiple times. Something like remember the device for the specific user for new 10-15 logins or next 7-15 days.

I checked the docs and seemed I can achieve this with aws amplify.

async function rememberDevice() {
  try{
    const result = await Auth.rememberDevice();
    console.log(result)
  }catch (error) {
    console.log('Error remembering device', error)
  }
}

But aws amplify is not working for me as it has an open issue. https://github.com/aws-amplify/amplify-js/issues/9204

In my cognito user pool I tried to set this one, but it's not helping as well. enter image description here

Is there any other option available in Cognito api to achieve my requirement?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda