added option to specify referer when authenticating