Rewrite credentials API to work with save on deploy.
Merge pull request #251 from Belphemur/credentials-pr

Rewrite credentials API to work with save on deploy.