It would be good if we can strip leading/trailing spaces in credentials before storing and using the keys. It is hard to figure out that the reason for invalid credentials error when it is relating to the presence of leading/trailing empty spaces.