Skip to content

Commit

Permalink
Merge pull request awslabs#1 from Savjee/master
Browse files Browse the repository at this point in the history
Using callback() instead of context.fail() and context.succeed()
  • Loading branch information
jackrk authored Nov 30, 2016
2 parents 3e57257 + 796619c commit b94ed6f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions blueprints/nodejs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
console.log('Loading function');

exports.handler = function(event, context) {
exports.handler = function(event, context, callback) {
console.log('Client token: ' + event.authorizationToken);
console.log('Method ARN: ' + event.methodArn);

Expand All @@ -23,7 +23,7 @@ exports.handler = function(event, context) {
var principalId = 'user|a1b2c3d4'

// you can send a 401 Unauthorized response to the client by failing like so:
// context.fail("Unauthorized");
// callback("Unauthorized", null);

// if the token is valid, a policy must be generated which will allow or deny access to the client

Expand Down Expand Up @@ -57,7 +57,7 @@ exports.handler = function(event, context) {
// policy.allowMethod(AuthPolicy.HttpVerb.GET, "/users/username");

// finally, build the policy and exit the function using context.succeed()
context.succeed(policy.build());
callback(null, policy.build());
};

/**
Expand Down

0 comments on commit b94ed6f

Please sign in to comment.