Backported auth changes (daa205e428ba0022a0b6a6a89c11f61bb8cb0984)