Amplify-js: CognitoUser.prototype.setUserMfaPreference is missing from typescript index

Created on 11 Apr 2018  路  6Comments  路  Source: aws-amplify/amplify-js

Do you want to request a feature or report a bug?
Bug

What is the current behavior?
Method is missing.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than AWS Amplify.

What is the expected behavior?
The function should be exposed

Which versions of Amplify, and which browser / OS are affected by this issue? Did this work in previous versions?
2.0.3
You can turn on the debug mode to provide more info for us by setting window.LOG_LEVEL = 'DEBUG'; in your app.

Cognito bug

Most helpful comment

I have tested the 2.0.4 beta package that had been pushed to NPM.

This line had been added
public setUserMfaPreference(smsMfaSettings: string[], softwareTokenMfaSettings: string[], callback: NodeCallback): void;

but it should have been
public setUserMfaPreference(smsMfaSettings: any, softwareTokenMfaSettings: any, callback: NodeCallback): void;

I can see that the meta data for the function is written like this:
/**

  • This is used by an authenticated user to enable MFA for himself
  • @param {string[]} smsMfaSettings the sms mfa settings
  • @param {string[]} softwareTokenMfaSettings the software token mfa settings
  • @param {nodeCallback} callback Called on success or error.
  • @returns {void}
    */

but the documentation defines the object to pass like this:
smsMfaSettings = {
PreferredMfa : true,
Enabled : true
};

and the server also accepts this object. A string[] would serialize completely different.
Can you please have another look at this @powerful23
Thanks

All 6 comments

Hi @HopScotch47, I have sent a PR about this fix to Amplify team. They will review it and merge it soon! Thanks.

I have tested the 2.0.4 beta package that had been pushed to NPM.

This line had been added
public setUserMfaPreference(smsMfaSettings: string[], softwareTokenMfaSettings: string[], callback: NodeCallback): void;

but it should have been
public setUserMfaPreference(smsMfaSettings: any, softwareTokenMfaSettings: any, callback: NodeCallback): void;

I can see that the meta data for the function is written like this:
/**

  • This is used by an authenticated user to enable MFA for himself
  • @param {string[]} smsMfaSettings the sms mfa settings
  • @param {string[]} softwareTokenMfaSettings the software token mfa settings
  • @param {nodeCallback} callback Called on success or error.
  • @returns {void}
    */

but the documentation defines the object to pass like this:
smsMfaSettings = {
PreferredMfa : true,
Enabled : true
};

and the server also accepts this object. A string[] would serialize completely different.
Can you please have another look at this @powerful23
Thanks

After testing with version 2.0.5 pushed to NPM yesterday
the function setUserMfaPreference still expects string[] parameters while it should take parameters of type any like that described in the documentation :
totpMfaSettings = {
PreferredMfa : true,
Enabled : true
};

@powerful23 will merge in the fix very soon.

Is there any updates to a fix for this - I see that in the 2.0.14 unstable releases still expect a string[]

@whiskerch sorry about that, will fix it soon.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

callmekatootie picture callmekatootie  路  3Comments

simon998yang picture simon998yang  路  3Comments

rayhaanq picture rayhaanq  路  3Comments

shinnapatthesix picture shinnapatthesix  路  3Comments

cosmosof picture cosmosof  路  3Comments