Add credential secret argument to `retrieveCredential` functions.

Fixes #2118.