check credentials beforehand