title: AWS S3 getObject JS SDK
body: <p>I am using JS SDK 2.7.13 for AWS. I can not seem to getObject from S3 using a web browser.</p>
  
  <p>i tried the code listed <a href="http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html" rel="nofollow noreferrer">here</a> </p>
  
  <pre><code>getS3Object(){
  
      AWS.config.region = 'us-east-1';
  
      AWS.config.update({
          credentials: new AWS.CognitoIdentityCredentials({
                IdentityPoolId: 'us-east-1:00000000-0000-0000-0000-000000000000'
          })
      });
      AWS.config.credentials.refresh(function(){
  
          let s3 = new AWS.S3({region: 'us-east-1', params: {Bucket: 'BUCKET NAME'}});
          let params = {
              Bucket: 'BUCKET NAME',
              Key: "NAME OF FILE I WANT"
          };
  
          s3.getObject(params, function(err, data) {
              if (err) console.log(err, err.stack); // an error occurred
              else     console.log(data);           // successful response
          });
      });
  }
  </code></pre>
  
  <p>I get </p>
  
  <pre><code>Error: Missing credentials in config
  </code></pre>
  
  <p>and</p>
  
  <pre><code>"NotAuthorizedException: Missing credentials in config
  </code></pre>
  
  <p>i can get the item if i use the url path but i also want to upload later on so i would need this to work.</p>