Fix bug when user credentials contains trailing spaces.