Skip to content

Commit

Permalink
Don't set credentials if they aren't first refreshed
Browse files Browse the repository at this point in the history
  • Loading branch information
Benny Powers committed Aug 30, 2017
1 parent 08b0f04 commit c10c131
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions aws-cognito.html
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,9 @@
const params = {IdentityPoolId, Logins};
const credentials = new AWS.CognitoIdentityCredentials(params);
credentials.expired = true;
this._setCredentials(credentials);
credentials.refresh((error) =>
error ? this.fireError(error)
: this._setCredentials(AWS.config.credentials));
this.refreshCredentials();
},

Expand Down Expand Up @@ -611,8 +613,9 @@
let credentials = new AWS.CognitoIdentityCredentials({IdentityPoolId});
credentials.clearCachedId(); // https://github.com/aws/aws-sdk-js/issues/609
credentials = new AWS.CognitoIdentityCredentials({IdentityPoolId});
this._setCredentials(credentials);
this.refreshCredentials();
credentials.refresh((error) =>
error ? this.fireError(error)
: this._setCredentials(AWS.config.credentials));
},

/**
Expand Down

0 comments on commit c10c131

Please sign in to comment.