For fingerprint authentication, I believe it's been established that they can hold you until you cooperate.
For passwords, they can't. "The second question is, can they detain you until you hand over your passcode? They probably have some power to detain you for a little bit — maybe for an hour or two — not forever. They can't hold at the border and say, ‘Alright, you're living here until you hand over your passcode.’"
Then the question is whether they can follow up with some sort of punishment after the fact if you continue to refuse. According to that article, it hasn't been established yet, but I'm confident that it would come out in my favor, and furthermore that they would think similarly and not even try it.