Add test helper to encode creds.
Simplify examples.