Praise be to Allah, and peace and blessings be upon the Messenger of Allah and his family.
If a fasting person needs to taste food whilst fasting , there is nothing wrong with that, and it does not affect the fast so long as none of the food enters the throat of the fasting person. This applies equally to coffee and other things.
If he tastes it without any need to do so, this is makruh, but it does not invalidate the fast.
Ibn 'Abbas said:
“There is nothing wrong with tasting what is being cooked or whatever.” (Narrated by al-Bukhari in a mu’allaq report)
Imam Ahmad said:
“I prefer that he should avoid tasting food, but if he does that it will not affect him and there is nothing wrong with that.” (Al-Mughni, 4/359)
Shaykh al-Islam [Ibn Taymiyah] said in al-Fatawa al-Kubra (4/474):
“Tasting food is makruh if there is no need to do that, but it does not break the fast.”
Shaykh Ibn ‘Uthaymin was asked in Fatawa al-Siyaam (p. 356): Is the fast invalidated by tasting food?
He replied:
“The fast is not invalidated by tasting food so long as one does not swallow it, but you should not do that unless there is a need for it; in that case if a little of it reaches your stomach by accident your fast is not invalidated.”
It says in Fatawa al-Lajnah al-Daimah (10/332):
“There is nothing wrong with a person tasting food during the day when fasting, when there is a need to do that, and his fast is valid if he does not deliberately swallow any of it.
If the taste or smell remains, that does not affect the fast, so long as you do not deliberately swallow anything.”
Ibn Sirin said:
“There is nothing wrong with using a wet siwak – i.e., when fasting. It was said: It has a flavour. He said: And water has a flavour, but you rinse your mouth with it.
Shaykh Ibn ‘Uthaymin said in al-Sharh al-Mumti’ (3/261):
“It is makruh to taste food such as dates, bread and soup, unless there is a need to do that, in which case it is OK.”
The reason for that is that some of this food may go down into the stomach without a person realizing, so tasting this food exposes him to spoiling the fast. Also he may be desiring the food a great deal, so he tastes it in order to enjoy it, and he may swallow it, then some of it goes down into his stomach.
Examples of necessity are when a cook needs to see how salty or sweet the food is, and so on.”
Based on this, there is nothing wrong with tasting the coffee when you are fasting, because you need to do that. But you have to be very cautious and make sure that nothing reaches your stomach.
And Allah knows best.