How to tell a real passport or an ID from a fake easily?

How can you verify if an identity document such as a passport or biometric permit is legitimate using just your smartphone?