A few years back, we had people posing as city workers or Utility workers gaining access to people homes to rob them. I don't think they ever caught them. I would say trust your instincts on this and be suspicious of everyone that you don't know.
Even if the Police at your door are bonafide, there is little reason to ever invite them into your home. Yu have to remember that even if there is a nice guy inside the uniform, he is generally bound to the statutes and his job is to spot infractions and use them against you in a court of law. You don't have to resist the police, but you don't have to invite them in. Conduct your business on the porch with the door closed and politely decline them when they ask real nice if they can step inside...
If you don't let anyone in as a rule, how could you be invaded?