adding auth from http://jsfiddle.net/danlec/nNesx/