better basic authentication handling