digiservnet / hibp-php

PHP library for accessing the Have I Been Pwned API.
MIT License
24 stars 4 forks source link

Missing hibp-api-key #12

Closed con2net closed 1 year ago

con2net commented 1 year ago

Hi Ian,

just tried to update my extension with your version 5.2 but I get an error while exploring breached sites by email-address.

With $breach = new Breach(new HibpHttp($this->APIKey)) I get:

[2023-04-11 14:08:06] request.CRITICAL: Uncaught PHP Exception GuzzleHttp\Exception\ClientException: "Client error:GET https://haveibeenpwned.com/api/v3/breachedaccount/paul.paulsen%40gmx.net?truncateResponse=false&includeUnverified=falseresulted in a401 Unauthorizedresponse: { "statusCode": 401, "message": "Access denied due to missing hibp-api-key." } " at /var/www/clients/client1/web31/web/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php line 113 {"exception":"[object] (GuzzleHttp\\Exception\\ClientException(code: 401): Client error:GET https://haveibeenpwned.com/api/v3/breachedaccount/paul.paulsen%40gmx.net?truncateResponse=false&includeUnverified=falseresulted in a401 Unauthorizedresponse:\n{ \"statusCode\": 401, \"message\": \"Access denied due to missing hibp-api-key.\" }\n at /var/www/clients/client1/web31/web/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113)"} []

I have a valid apikey from hibp, but for some reasons, the new version didn´t recognize it?

Any idea what I might have missed?

icawebdesign commented 1 year ago

Hi Stefan..

Thanks for reporting this (and the followup email with more detail). Let me look into this and see why it's failing.

icawebdesign commented 1 year ago

Thanks again for reporting this Stefan. You should find this fixed now in both the 5.3 release and 6.1 release.