Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9260671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:57:10+00:00 2026-06-18T12:57:10+00:00

I am attempting to follow the AWS API for getting a JavaScript file from

  • 0

I am attempting to follow the AWS API for getting a JavaScript file from a private S3 bucket. The guide is here: Signing and Authenticating REST Requests

The environment is a browser with jQuery, so this is a JavaScript implementation. I have worked through what I considered to be the hard part – signing the request with the secret key. But now I am hung up on something supposedly easy. I have this resulting REST request to transmit:

GET /gss3/sayHello.js HTTP/1.1
Host: gss3.s3.amazonaws.com
Date: Thu Feb 07 2013 08:16:25 GMT-0500 (Eastern Standard Time)
Authorization: AWS AKIAJTURNBE6SXNTVVGQ:eWJOLZnj6Eja3CEC2CyifeURnxg=

Since this is a call to s3.amazonaws.com from http://www.mydomain.com, I was looking at JSONP to get around the same origin policy. However, I don’t see any way to add extra headers to a jQuery JSONP call, and to authenticate with AWS you have to pass that 4th line:

Authorization: AWS AKIAJTURNBE6SXNTVVGQ:eWJOLZnj6Eja3CEC2CyifeURnxg=

So my question is this: how the heck do I transmit this REST request to AWS in my browser / jQuery environment? What am I missing here? Thanks gang….

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T12:57:11+00:00Added an answer on June 18, 2026 at 12:57 pm

    Although this source was written for PHP, the blog Amazon AWS S3 Query String Authentication with PHP shows how to compile a plain old querystring and pass the signature as a parameter to S3.

    $url .= '?AWSAccessKeyId='.$awsKeyId
    .'&Expires='.$expires
    .'&Signature='.$signature;
    

    Using the crypto-js and converting to Javascript then gives us something like this:

    var filePath = "/bucket/file.js";
    var dateTime = Math.floor(new Date().getTime() / 1000) + 300; // allows for 5 minutes clock diff
    var stringToSign = "GET\n\n\n" + dateTime + "\n" + filePath;
    var signature = CryptoJS.enc.Base64.stringify(CryptoJS.HmacSHA1(stringToSign, secretAccessKey));
    var queryString = "?AWSAccessKeyId=" + accessKeyId + "&Expires=" + dateTime + "&Signature=" + encodeURIComponent(signature);
    
    var script = document.createElement("script");
    script.type = "text/javascript";
    script.src = "https://s3.amazonaws.com/bucket/file.js" + queryString;
    $("head").append(script); // jQuery version
    

    And there you go, almost the whole banana written for you. I hope this helps someone out.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am attempting to follow the besic guide given here on embedding lua into
I am attempting to follow the tutorial at: http://www.youtube.com/watch?v=v9TG7OzsZqQ My Cloud Endpoint REST API
I'm attempting to follow Heroku's python quickstart guide but am running into repeated problems.
I am attempting to follow along to this tut: HERE but using a sprite
Using NPOI and attempting to follow a tutorial here: http://www.zachhunter.com/2010/05/npoi-excel-template/ , I'm coming across
so I added all the jars from jMock 2.5.1 While attempting to follow http://www.ibm.com/developerworks/opensource/library/os-eclipse-rmock/index.html
I'm trying to follow a guide located here to know avail :(. Here's a
When attempting to follow examples from Engineering Long-Lasting Software (Fox and Patterson) the command:
In attempting to follow the instructions here - http://msdn.microsoft.com/en-us/library/hh202949.aspx I have coded a very
I'm attempting to follow along with the RestKit unit test guide ( https://github.com/RestKit/RestKit/wiki/Unit-Testing-with-RestKit )

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.