The API method pwg.images.uploadAsync returns the error 999 (Invalid username/password) when the username and password are replaced with the API public and secret keys introduced with Piwigo 16. Adding the HTTP header "Authorization" does not help.
Is this a bug or should I proceed differently?
The API method `pwg.images.uploadAsync` returns the error 999 (Invalid username/password) when the username and password are replaced with the API public and secret keys introduced with Piwigo 16. Adding the HTTP header "Authorization" does not help.
Is this a bug or should I proceed differently?
<!-- github-sync-id:3611624753 -->
I reproduce the problem. The test of preg_match('/^pkid-\d{8}-[a-z0-9]{20}$/i', $params['username']) is only in pwg.session.login. @LintyDev will fix that :-)
Question it raises : what if the API client provides both header Authorization and username/password?
I reproduce the problem. The test of `preg_match('/^pkid-\d{8}-[a-z0-9]{20}$/i', $params['username'])` is only in `pwg.session.login`. @LintyDev will fix that :-)
Question it raises : what if the API client provides both header `Authorization` and username/password?
<!-- github-comment-id:3516414869 -->
With this fix, pwg.images.uploadAsync returns a HTTP Authentication error 401 when called with wrong API keys.
As for other API methods, it should instead return a HTTP 200 status code (the communication went well) and an API error telling that the keys are invalid.
With this fix, `pwg.images.uploadAsync` returns a HTTP Authentication error 401 when called with wrong API keys.
As for other API methods, it should instead return a HTTP 200 status code (the communication went well) and an API error telling that the keys are invalid.
<!-- github-comment-id:3650741312 -->
With this fix, pwg.images.uploadAsync returns a HTTP Authentication error 401 when called with wrong API keys.
As for other API methods, it should instead return a HTTP 200 status code (the communication went well) and an API error telling that the keys are invalid.
I will discuss this with plg, because in my opinion, an API key error should never return a 200 status response
> With this fix, `pwg.images.uploadAsync` returns a HTTP Authentication error 401 when called with wrong API keys.
>
> As for other API methods, it should instead return a HTTP 200 status code (the communication went well) and an API error telling that the keys are invalid.
I will discuss this with plg, because in my opinion, an API key error should never return a 200 status response
<!-- github-comment-id:3671098506 -->
Until the introduction of the API keys, HTTP and Piwigo errors were always differentiated. For example, when credentials are wrong (username/password or API keys), Piwigo returns an error 999, not a HTTP Error 401. So please do not change the way errors are managed.
Until the introduction of the API keys, HTTP and Piwigo errors were always differentiated. For example, when credentials are wrong (username/password or API keys), Piwigo returns an error 999, not a HTTP Error 401. So please do not change the way errors are managed.
<!-- github-comment-id:3671149679 -->
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
The API method
pwg.images.uploadAsyncreturns the error 999 (Invalid username/password) when the username and password are replaced with the API public and secret keys introduced with Piwigo 16. Adding the HTTP header "Authorization" does not help.Is this a bug or should I proceed differently?
What if you don't provide username/password and only http header
Authorization?I reproduce the problem. The test of
preg_match('/^pkid-\d{8}-[a-z0-9]{20}$/i', $params['username'])is only inpwg.session.login. @LintyDev will fix that :-)Question it raises : what if the API client provides both header
Authorizationand username/password?I get the error 1002 "Missing parameters: username" if I only use the HTTP header
Authorization.Thanks
With this fix,
pwg.images.uploadAsyncreturns a HTTP Authentication error 401 when called with wrong API keys.As for other API methods, it should instead return a HTTP 200 status code (the communication went well) and an API error telling that the keys are invalid.
Please correct the error returned when API key are revoked or invalid.
I will discuss this with plg, because in my opinion, an API key error should never return a 200 status response
Until the introduction of the API keys, HTTP and Piwigo errors were always differentiated. For example, when credentials are wrong (username/password or API keys), Piwigo returns an error 999, not a HTTP Error 401. So please do not change the way errors are managed.