title: UnrecognizedClientException: The security token included in the request is invalid when calling AWS.SecretsManager
body: <p>I'm implementing AWS ClientManager to obtain secret variables saved in AWS. I had initial implementation like below:</p>
  
  <pre><code>// Load the AWS SDK
  var AWS = require('aws-sdk'),
      region = "us-west-2",
      secretName = "secretName",
      accessKeyId = myAccessKey,
      secretAccessKey = mySecretAccessKey,
      secret,
      decodedBinarySecret;
  
  var client = new AWS.SecretsManager({
      region: region,
  });
  
  client.getSecretValue({SecretId: secretName}, function(err, data) {
      if (err) {
        console.log("Error Happened");
        console.log(err);
      }
      else {
          if ('SecretString' in data) {
              secret = data.SecretString;
          } else {
              let buff = new Buffer(data.SecretBinary, 'base64');
              decodedBinarySecret = buff.toString('ascii');
          }
      }
  });
  </code></pre>
  
  <p>When I start the server it throws the following exception</p>
  
  <blockquote>
    <p>{ UnrecognizedClientException: The security token included in the request is invalid.
     message: 'The security token included in the request is invalid.',
     code: 'UnrecognizedClientException',
     time: 2019-07-01T12:16:00.021Z,
     requestId: 'c7ed53c1-fb70-4012-aa9f-5a9a3195a043',
     statusCode: 400,
     retryable: false,
     retryDelay: 40.923844792180674 }</p>
  </blockquote>