diff --git a/src/deep-security/lib/Token.js b/src/deep-security/lib/Token.js
index <HASH>..<HASH> 100644
--- a/src/deep-security/lib/Token.js
+++ b/src/deep-security/lib/Token.js
@@ -147,13 +147,11 @@ export class Token {
 
     this._credentials = new AWS.CognitoIdentityCredentials(cognitoParams);
 
-    AWS.config.credentials = this._credentials;
-
     if (this.identityId) {
       // trying to load old credentials from CognitoSync
        this._credsManager.loadCredentials(this.identityId, (error, credentials) => {
          if (!error && credentials && this.validCredentials(credentials)) {
-           callback(null, this._credentials = credentials);
+           callback(null, AWS.config.credentials = this._credentials = credentials);
            return;
          } else {
            this._refreshCredentials(this._credentials, callback);
@@ -184,6 +182,8 @@ export class Token {
         return;
       }
 
+      AWS.config.credentials = this._credentials;
+
       // @todo - save credentials in background not to affect page load time
       this._credsManager.saveCredentials(credentials, (error, record) => {
         if (error) {
#<I> - Fix credentials assignment to AWS.config.credentials