Authentication

Authentication

Every request carries a secret key in the Authorization header. There is no other way in, and no request is ever authenticated by a session cookie.

Keys

A key is shown once, at the moment it is created. Keep it somewhere the servers can read it and a browser cannot.

  • pc_sk_live_…
  • pc_sk_test_…

Test and live stay separate

The mode is bound into the credential itself rather than passed as a parameter, so a test key can neither read nor change live data. A misrouted request fails instead of reaching the wrong catalogue. Test passports are deleted 90 days after the passport itself was last edited.

Sending the key

Bearer authentication over HTTPS. Nothing else is accepted, and a request without the header is refused before it reaches any resource.

Request
curl "https://passportcraft.com/api/v1/whoami" \
  -H "Authorization: Bearer pc_sk_live_…"

Browser credentials are deliberately unsupported. A key belongs on a server, and a key in front-end code is a key that has been published.

Scopes

A key carries a fixed set of scopes, chosen when it is created. A request that lacks the scope its endpoint requires is refused, and the refusal names the permission that was missing.

Authentication — PassportCraft API | PassportCraft