Skip to content

Commit

Permalink
new usage method and example
Browse files Browse the repository at this point in the history
  • Loading branch information
icaliman committed Mar 27, 2015
1 parent 1227354 commit d4c4b7d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,27 @@ signer.sign(opts);
Parse.Cloud.httpRequest(opts);
```

or

```js
var AwsSign = require('cloud/modules/aws-sign.js');
var signer = new AwsSign({
accessKeyId: 'AKIAIOSFODNN7EXAMPLE',
secretAccessKey: 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY'
});

Parse.Cloud.httpRequest(signer.sign({
method: 'PUT',
url: 'http://johnsmith.s3.amazonaws.com/photos/puppy.jpg',
headers: { ... },
... // Other request options, ignored by AwsSign.
body: {}
success: function() {},
error: function() {}
}));
```


The following keys are mandatory:

* `method`
Expand Down
2 changes: 2 additions & 0 deletions aws-sign.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ AWSRestSigner.prototype.sign = function(opts) {
}

opts.headers["Authorization"] = this._sign(method, bucket, path, date, contentType, contentMd5, xAmzHeaders);

return opts;
}


Expand Down

0 comments on commit d4c4b7d

Please sign in to comment.