Skip to content

Calculates Authorization header for Amazon AWS REST requests, for Parse.com

Notifications You must be signed in to change notification settings

kyptov/parse-aws-sign

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

aws-sign

Simple module to calculate Authorization header for Amazon AWS REST requests, for Parse.com.

Usage

  1. Put 'aws-sign.js' file into your 'cloud/modules/' folder.
  2. Require module in Cloud Code.

Examples

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

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

Parse.Cloud.httpRequest(opts);

or

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
  • url

Others are optional. A date header (headers.date) will be added for you if it is not already set.

About

Calculates Authorization header for Amazon AWS REST requests, for Parse.com

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%