Yehoshua was a prophet
Mishneh Torah» Sefer Madda » Yesodei haTorah - Chapter Ten
When a prophet proclaims that another individual is [also] a prophet, we accept the latter as a prophet without requiring [any further] investigation. Thus, after Moses, our teacher, proclaimed that Joshua [was a prophet], all the Jews believed in him before he performed any wonders. The same holds true for subsequent generations. ...
Mishneh Torah» Sefer Madda » Yesodei haTorah - Chapter Nine
When a prophet - who has already proven himself to be a prophet - instructs us to violate one of the mitzvot of the Torah or many mitzvot, whether they be of a severe or light nature, for a limited amount of time, it is a mitzvah to listen to him.
The Sages of the early generation taught as part of the oral tradition: If a prophet tells you to violate the precepts of the Torah as Elijah did on Mount Carmel, listen to him with regard to all things except the worship of false gods. This applies when his command is temporary in nature.
If they would have asked Elijah: How can we violate the Torah's command [Deuteronomy 12:13]: "[Be careful...] lest you offer your burnt offerings everywhere"?, he would have told them: We should not say anything, but anyone who offers a sacrifice outside [the Temple premises] is liable for karet, as Moses said. [The present instance,] however, [is an exception]. I am offering a sacrifice today outside [the Temple] at God's command in order to disprove the prophets of Ba'al.
Similarly, if any [other] prophet commands us to transgress for a limited time, it is a mitzvah to listen to him. If, however, he says that the mitzvah has been nullified forever, he is liable for execution by strangulation, for the Torah has told us: "[It is] for us and our children forever."