JS authentication mechanism