It is common practice by law enforcement to approach people assertively hoping they do not know their rights. Asking to search your car in an intimidating way it one of the most common offence. The same thing happens in states that do not have stop and ID laws hoping people simply don’t know they don’t have to in those states.
The only way to protect yourself is know the laws in your state and don’t be intimidated. Most important is record the police whenever they engage you. One of the reasons for this is when police bodycam or dashcam footage shows them in the wrong, chances of you getting a copy of that footage range from not a chance with corrupt police to slim with other police.
Finding out about your rights is easy with plenty of options. Perhaps the best place to start is with Google with the following search terms:
US Rights
Stop and ID states
Stop and ID laws (Your state)
US stop and search laws