Are Lie Detectors Illegal?

Is it legal to do a lie detector test?

.