Closed maxdavidson closed 6 years ago
React Native support was just released so we would have to look into it. You mentioned this doesn't happen in the browser, correct? Also if you disable device tracking in the console will it work?
Turns out it doesn't work in the browser, because of the missing third callback
parameter to authenticationHelper.generateHashDevice
. It's the same problem causing #586 and #588.
K, so in the browser we can add a check for the existence of callback.
Or just add the callback so it works in as intended in the both the browser and RN
Pull request with fix has been merged.
Beautiful!
In c359661350c98fd0d25ec8f3cd5fd494c5a167d7, some functions were made asynchronous with the introduction of native bindings in React Native.
generateHashDevice
inAuthenticationHelper.js
was given a callback parameter because of its use ofmodPow
, but the callback is not used inCognitoUser.js
https://github.com/aws/amazon-cognito-identity-js/blob/c359661350c98fd0d25ec8f3cd5fd494c5a167d7/src/AuthenticationHelper.js#L137-L156
https://github.com/aws/amazon-cognito-identity-js/blob/c359661350c98fd0d25ec8f3cd5fd494c5a167d7/src/AuthenticationHelper.js#L126-L128
https://github.com/aws/amazon-cognito-identity-js/blob/c359661350c98fd0d25ec8f3cd5fd494c5a167d7/src/CognitoUser.js#L363-L374
This happens to work in the browser, since the callback is called synchronously. However, this will create an error in RN, because
authenticationHelper.verifierDevices
is accessed before it's assigned, andutil.Buffer
will be instantiated withundefined
.