set credentials as function