Yes by law legally the police officer has to identify themselves to you when you ask them for there name, badge number etc.
If the police officer fails to identify themselves to you then you should get a supervisor to come out especially if the police officer is stopping you or arresting you.
A police officer has to tell you there name, bad number etc and why they are stopping you.
If a police officer is failing to identify themselves then that could mean that they are not a real police officer although I've come across a few police officers who failed to identify themselves.
The police officer could get into trouble if they fail to identify themselves to someone they are arresting or stopping or detaining.
If a police officer tells you that they are not required to identify themselves then they are wrong about that and you should tell them that they could get into trouble themselves for failing to identify themselves.