Rewritten authentication with async