Skip to content

Commit

Permalink
Refresh credentials if _getSession fails
Browse files Browse the repository at this point in the history
  • Loading branch information
Benny Powers committed Sep 7, 2017
1 parent 35f220a commit 8ac344e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions aws-cognito.html
Original file line number Diff line number Diff line change
Expand Up @@ -573,8 +573,12 @@
_getSession: function(user) {
if (!user.username) return Promise.reject();
return new Promise((resolve, reject) => {
user.getSession((err, sess) => {
err ? reject(err) : resolve(sess);
user.getSession((error, sess) => {
if (error) {
this.refreshCredentials()
.catch((err) => reject(err));
}
else resolve(sess);
});
});
},
Expand Down

0 comments on commit 8ac344e

Please sign in to comment.