This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(context, cb) { | |
if (!context.headers['x-api-key']) { | |
return cb(401, 'Unauthorized'); | |
} | |
cb(null, { | |
authenticated: true, | |
user: 'user', | |
}); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(context, cb) { | |
if (!context.query.apiKey) { | |
return cb(401, 'Unauthorized'); | |
} | |
cb(null, { | |
authenticated: true, | |
user: 'Zapier', | |
}); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(context, cb) { | |
if (context.body) { | |
if (!context.body.email || !context.body.pass) { | |
return cb(401, 'Unauthorized'); | |
} | |
} else if (!context.headers['x-token']) { | |
return cb(403, 'Forbidden'); | |
} | |
const now = new Date(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const finish = (cb, url) => { | |
console.log('Sending to', url); | |
cb(null, {url: url}); | |
} | |
exports.handler = (event, context, callback) => { | |
const defaultURL = 'http://example.com'; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This code has a break rate of < 10%. It's still unnacceptable, though. | |
var request = require( 'request' ).defaults( { jar: true } ), | |
q = require( 'q' ); | |
var URI = 'http://demo.visualcaptcha.net/'; | |
// Make a post | |
var makePost = function makePost( imgHash, partialURL, tryNumber ) { | |
var deferred = q.defer(), |
NewerOlder