Tweaked authentication to stop exceptions from being thrown.

Added environment variable docs.