I am unable to get authenticateUser to work ever since I have upgraded angular-cli to webpack and angular2 final.
Currently using aws-sdk 2.6.4 and sjcl 1.06
angular-cli
"scripts": [
"../node_modules/jquery/dist/jquery.min.js",
"../public/jsbn.js",
"../public/jsbn2.js",
"../node_modules/sjcl/sjcl.js",
"../public/aws-cognito-sdk.min.js",
"../public/amazon-cognito-identity.min.js",
"../node_modules/aws-sdk/dist/aws-sdk.js",
"../node_modules/bootstrap/dist/js/bootstrap.js"
],
any ideas?
Most probably you are missing some sjcl functions. Can you pull sjcl from github, that should have all the necessary codecs.
I tried the master from https://github.com/bitwiseshiftleft/sjcl and I received the same error.
I also ensured codec,bytes is included.
This is an issue with angular-cli and how it is loading scripts for webpack in the angular-cl.json file. SJCL is null in the amazon-cognito-identity.min.js file.
I pulled down the amazon-cognito-identity-js project. Rebuilding amazon-cognito-identity.min.js so that SJCL is set to false for excluding 3rd party in the webpack.config.js file fixes this. Obviously forcing a 3rd party to included in the build is less than desirable but it does fix it for now.
Hello @neojack647
Please elaborate a little more in your solution. Its not clear to me how to fix this.
Thank you
In the webpack.config.js of the amazon-cognito-identity-js project I set SJCL = false
Then rebuilt the project
setting it to false forces the thirdparty file to be included in the build.
Not sure if that answers your question.
Hey @neojack647, great hack! That works for me as well. Can you file an issue at angular-cli for that? Unfortunately I'm still not getting in depth what is getting wrong, but I would highly appreciate to not rely on my homebrew amazon-cognito-identity-js.js forever. Thanks in advance.
This got closed, but what's the solution for angular-cli? Using a homebrew js is a workaround at best.
I moved the javascript library files to index.html, and things worked:
`
`
Adding these does not resolve the issue on my side, really strange as I have a working project that using the same code yet does not encounter this issue.
The only difference is that the one is using verification on signup. But once a user is verified and sign in call made I don't see how this can be an issue.
It fails at:
cognitoUser.authenticateUser(authenticationDetails, {
I went ahead an cloned the entire repo - reference js files, now I get something completely different, see image:

This is strange because I only want MFA on signup, not sign in... MFA on signup works.
But this error is being thrown for sign in
UPDATE: This is solved by disabling MFA - which only works for SMS
Most helpful comment
In the webpack.config.js of the amazon-cognito-identity-js project I set SJCL = false
Then rebuilt the project
setting it to false forces the thirdparty file to be included in the build.
Not sure if that answers your question.