I've been looking into sites (like Alibaba, etc...) for components, but they are usually at the price of the rain. How can someone know if a company or factory is not a scam and that those components really belong to said factory?
Except for blantantly obvious counterfeits where the manufacturer name is misspelled (yes, that has actually happened), it is difficult for you to tell. The best way to avoid this problem is to use reputable suppliers, like Mouser, DigiKey, Element-14, etc.
There is no way I'd ever buy parts from Alibaba. There is a reason some sites have such low prices. Think about it. How can someone sell you small quantities of parts for less than places like Mouser that buy in bulk directly from the manufacturers? These are parts they got as "surplus" from companies that supposedly bought more than they needed (sometimes that's legit, but sometimes these parts were abused or failed tests, which is why the company that bought them is dumping them), knockoff parts made to lower quality standards to cut costs, outright frauds, or even parts that "fell off a truck" in Asia someplace.
Except for the obvious it will be very hard to tell. But one of the best ways is to keep an open mind and don't fall into the trap of painting everyone with the same brush. That is the start of stereotyping which leads to worse things.
The fact is, if you purchase through Western distribution your are suffering from huge mark ups. The reason why costs in some other locations are much much lower is that there is less collusion and more competition and in some cases counterfeit parts. As a case in point, in ramping production for large volumes we got quotes from around the world (through local vendors/partners) and the price difference was staggering ... and these where the same parts, made in the same factory (In Europe) and drop shipped from the same factory. When faced with the proof that they were trying to fleece us with the North American Quotes they matched prices that the factory gave us else where.
So things are not as simple as they might first appear.
Certainly there will be bad people, selling bad products, wherever you are. The best strategy is to mix your supply chain, order from multiple locations and let every vendor know what you are doing. For the North America supply chain they will know they have non colluding competition so will sell you parts that aren't as marked up, with your Asian suppliers they will realize that you have direct comparatives for quality and so will not attempt to mix in re-worked parts etc.
If you can't do this, then order from the most secure source you know of but know that North American vendors often deliberately mark up prices and can keep them high because of FUD (Fear Uncertainty and Doubt). And in all things, even this is not uniformly applied so do your research. There is no single answer.