Add support for advanced auth
cherry-pick: Yet another patch helper tool