What is the troubleshooting for an unauthorized API search?
Symptom
- First we do a token request which is successful.
- But the subsequent search for metadata returns “Unauthorized”.
Applies to
- API de metadatos de WorldCat
- OCLC APIs
Resolution
This can happen when the call to the API doesn’t include an authorization header.
Example
An unauthorized call has no authorization header:
-H "Bearer tk_IdQcD8F8fgKoxC3HbZYXRCgsuoXpNOTAKEY0eBc"
An authorized call adds an authorization header like so:
-H "Authorization: Bearer tk_IdQcD8F8fgKoxC3HbZYXRCgsuoXpNOTAKEY0eBc"