lib/credentials/temporary_credentials.js
function TemporaryCredentials(params) {
    AWS.Credentials.call(this);
    this.loadMasterCredentials();
    this.expired = true;

    this.params = params || {};
    if (this.params.RoleArn) {
      this.params.RoleSessionName =
        this.params.RoleSessionName || 'temporary-credentials';
    }
    this.service = new AWS.STS({params: this.params});
  }
function TemporaryCredentials(params) {
    AWS.Credentials.call(this);
    this.loadMasterCredentials();
    this.expired = true;

    this.params = params || {};
    if (this.params.RoleArn) {
      this.params.RoleSessionName =
        this.params.RoleSessionName || 'temporary-credentials';
    }
    this.service = new AWS.STS({params: this.params});
  }
Creates a new temporary credentials object.

@note In order to create temporary credentials, you first need to have
"master" credentials configured in {AWS.Config.credentials}. These
master credentials are necessary to retrieve the temporary credentials,
as well as refresh the credentials when they expire.
@param params [map] a map of options that are passed to the
{AWS.STS.assumeRole} or {AWS.STS.getSessionToken} operations.
If a `RoleArn` parameter is passed in, credentials will be based on the
IAM role.
@example Creating a new credenials object for generic temporary credentials
AWS.config.credentials = new AWS.TemporaryCredentials();
@example Creating a new credentials object for an IAM role
AWS.config.credentials = new AWS.TemporaryCredentials({
RoleArn: 'arn:aws:iam::1234567890:role/TemporaryCredentials',
});
@see AWS.STS.assumeRole
@see AWS.STS.getSessionToken