Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge cognito pr 662, 668 #248

Merged
merged 2 commits into from Feb 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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

Large diffs are not rendered by default.

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions packages/amazon-cognito-identity-js/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