Subject: | google books api says "401: unknown authorization header" |
The headers added around lines 177-178 in XML/Atom/Client.pm cause
Google Books API Atom requests to fail with a "401: Unknown
authorization header" error. For your convenience, here is a feed url
that should work for testing:
http://books.google.com/books/feeds/volumes?q=author%3AChalmers%20title%3AThe%20Conscious%20Mind&min-viewability=partial&max-results=1
Google's API is public and does not require authorization. A simple fix
is to make the headers conditional on a username having been provided
(which would seem desirable anyway), e.g. :
if ($client->username) {
$req->header('X-WSSE', sprintf
qq(UsernameToken Username="%s", PasswordDigest="%s",
Nonce="%s", Created="%s"),
$client->username || '', $digest, $nonce_enc, $now);
$req->header('Authorization', 'WSSE profile="UsernameToken"');
}
db