changed setCredentials to take a credentials object