* Put auth detection in a central place.