err:unkey:authentication:missingExample response
Likely causes
- You called a portal endpoint (
portal.listKeys,portal.rerollKey,portal.getVerifications) with anAuthorizationheader. Those endpoints only accept theportal_sessioncookie, and ignore it when anAuthorizationheader is present. The message isYou must provide a bearer credential in the Authorization header. - You put the root key in the body or a custom header instead of
Authorization. - Rarely, an endpoint that needs a signed-in caller got a request without one. The message is
You must authenticate before accessing this resource.
Authorization header at all returns err:unkey:application:invalid_input instead. A header that isn’t in the form Bearer <token> returns err:unkey:authentication:malformed.
How to fix
-
Send your root key as a bearer token on every request:
The key you’re verifying goes in the body. The root key goes in the header.
-
On a portal endpoint, drop the
Authorizationheader and send theportal_sessioncookie instead.
Related errors
err:unkey:authentication:malformed: the header is present but notBearer <token>.err:unkey:application:invalid_input: theAuthorizationheader is missing.err:unkey:authentication:key_not_found: the token is well formed but isn’t a valid root key.