rename authenticate to keystore
Added condition for keystore server error, changed 'site' parameter to be document.location.hostname