You can only get a residence permit if you are able to travel to Finland and stay in the country legally. To do this, you must have a passport that is valid throughout the time your residence permit is valid.