Correcting authentication flow