Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am charlesdaniel on github.
  • I am charlesdaniel (https://keybase.io/charlesdaniel) on keybase.
  • I have a public key ASCq00O0Xej5mfRa1WexznmTQzj4Iq_-eOOju_cLrcxrXwo

To claim this, I am signing this object:

var apns = require('./node_modules/apn');
var options = { //This is a real prod cert
cert: 'cert.pem', // valid cert
key: 'key.pem', // valid key
gateway: 'gateway.push.apple.com',
port: 2195,
enhanced: true,
cacheLength: 5,
errorCallback: function(err, notification) { console.log(" ERROR FROM CALLBACK : ", err, "NOTIFICATION ", notification); },
@charlesdaniel
charlesdaniel / basic_auth_nodejs_test.js
Created January 27, 2012 02:53
Example of HTTP Basic Auth in NodeJS
var http = require('http');
var server = http.createServer(function(req, res) {
// console.log(req); // debug dump the request
// If they pass in a basic auth credential it'll be in a header called "Authorization" (note NodeJS lowercases the names of headers in its request object)
var auth = req.headers['authorization']; // auth is in base64(username:password) so we need to decode the base64
console.log("Authorization Header is: ", auth);