Skip to content
This repository has been archived by the owner on Aug 21, 2023. It is now read-only.

Commit

Permalink
merge cognito pr 662, 668 (aws-amplify#248)
Browse files Browse the repository at this point in the history
  • Loading branch information
richardzcode authored and mlabieniec committed Feb 9, 2018
1 parent 911bcbe commit a17661f
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 29 deletions.
20 changes: 9 additions & 11 deletions dist/amazon-cognito-identity.js
Expand Up @@ -4111,6 +4111,13 @@ return /******/ (function(modules) { // webpackBootstrap
var challengeResponses = {};
challengeResponses.USERNAME = this.username;
challengeResponses.ANSWER = answerChallenge;

var authenticationHelper = new _AuthenticationHelper2.default(this.pool.getUserPoolId().split('_')[1]);
this.getCachedDeviceKeyAndPassword();
if (this.deviceKey != null) {
challengeResponses.DEVICE_KEY = this.deviceKey;
}

var jsonReq = {
ChallengeName: 'CUSTOM_CHALLENGE',
ChallengeResponses: challengeResponses,
Expand All @@ -4125,16 +4132,7 @@ return /******/ (function(modules) { // webpackBootstrap
return callback.onFailure(err);
}

var challengeName = data.ChallengeName;

if (challengeName === 'CUSTOM_CHALLENGE') {
_this6.Session = data.Session;
return callback.customChallenge(data.ChallengeParameters);
}

_this6.signInUserSession = _this6.getCognitoUserSession(data.AuthenticationResult);
_this6.cacheTokens();
return callback.onSuccess(_this6.signInUserSession);
return _this6.authenticateUserInternal(data, authenticationHelper, callback);
});
};

Expand Down Expand Up @@ -5179,7 +5177,7 @@ return /******/ (function(modules) { // webpackBootstrap
if (err) {
return callback.onFailure(err);
}
return callback(null, data);
return callback.onSuccess(data);
});
}
};
Expand Down
12 changes: 6 additions & 6 deletions dist/amazon-cognito-identity.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/amazon-cognito-identity.min.js.map

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions src/CognitoUser.js
Expand Up @@ -636,6 +636,15 @@ export default class CognitoUser {
const challengeResponses = {};
challengeResponses.USERNAME = this.username;
challengeResponses.ANSWER = answerChallenge;

const authenticationHelper = new AuthenticationHelper(
this.pool.getUserPoolId().split('_')[1]
);
this.getCachedDeviceKeyAndPassword();
if (this.deviceKey != null) {
challengeResponses.DEVICE_KEY = this.deviceKey;
}

const jsonReq = {
ChallengeName: 'CUSTOM_CHALLENGE',
ChallengeResponses: challengeResponses,
Expand All @@ -650,16 +659,7 @@ export default class CognitoUser {
return callback.onFailure(err);
}

const challengeName = data.ChallengeName;

if (challengeName === 'CUSTOM_CHALLENGE') {
this.Session = data.Session;
return callback.customChallenge(data.ChallengeParameters);
}

this.signInUserSession = this.getCognitoUserSession(data.AuthenticationResult);
this.cacheTokens();
return callback.onSuccess(this.signInUserSession);
return this.authenticateUserInternal(data, authenticationHelper, callback);
});
}

Expand Down Expand Up @@ -1634,7 +1634,7 @@ export default class CognitoUser {
if (err) {
return callback.onFailure(err);
}
return callback(null, data);
return callback.onSuccess(data);
});
}
}
Expand Down

0 comments on commit a17661f

Please sign in to comment.