Since I have upgraded to 16.1, calling API methods with API Keys in HTTP header returns HTTP 401 Access denied (it worked well with version 16.0).
To reproduce the issue:
Open the Piwigo web API explorer
Call pwg.session.login with API keys as username and password
Call pwg.session.getStatus with API keys separated by ":" in the Authorization field
The returned user status is guest.
Since I have upgraded to 16.1, calling API methods with API Keys in HTTP header returns HTTP 401 Access denied (it worked well with version 16.0).
To reproduce the issue:
- Open the Piwigo web API explorer
- Call pwg.session.login with API keys as username and password
- Call pwg.session.getStatus with API keys separated by ":" in the Authorization field
The returned user status is guest.
<!-- github-sync-id:3703879337 -->
Now regarding your workflow: when you call pwg.session.login you generate a server-side session and you get your cookie filled with the session id. If you call pwg.session.getStatus without providing X-PIWIGO-API header, you should get informations about the connected user in the current session.
If you provide the X-PIWIGO-API header when calling pwg.session.getStatus, Piwigo should use it instead of the session [... a few minutes later...] and it works fine, see my 2 screenshots:
After I logged in as "plg2", pwg.session.getStatus correctly says username="plg2".
If I provide an X-PIWIGO-API header with the apiKeyID:apiKeySecret, then pwg.session.getStatus correctly says username="plg".
@EddyLB did you change the header to X-PIWIGO-API in your iOS app?
Hi @EddyLB
It reminds me of https://piwigo.org/forum/viewtopic.php?pid=193631#p193631 : you need to clear your web browser case so that `tools/ws.htm` uses the correct header `X-PIWIGO-API` that replaces `Authorization` in version 16.1.0
Now regarding your workflow: when you call `pwg.session.login` you generate a server-side session and you get your cookie filled with the session id. If you call `pwg.session.getStatus` without providing `X-PIWIGO-API` header, you should get informations about the connected user in the current session.
If you provide the `X-PIWIGO-API` header when calling `pwg.session.getStatus`, Piwigo should use it instead of the session [... a few minutes later...] and it works fine, see my 2 screenshots:
<img width="683" height="683" alt="Image" src="https://github.com/user-attachments/assets/f131a19b-4768-4186-bdd1-cd8058372e91" />
After I logged in as "plg2", `pwg.session.getStatus` correctly says `username="plg2"`.
<img width="683" height="683" alt="Image" src="https://github.com/user-attachments/assets/43070133-b6b6-406d-bb73-8b0ac9986ddd" />
If I provide an `X-PIWIGO-API` header with the apiKeyID:apiKeySecret, then `pwg.session.getStatus` correctly says `username="plg"`.
@EddyLB did you change the header to `X-PIWIGO-API` in your iOS app?
<!-- github-comment-id:3626472887 -->
Thanks @plegall for your reply.
I have cleaned the cache and it now seems to work with the web API explorer.
Yes it was changed in the iOS app. The problem is that I used X_PIWIGO_API instead of X-PIWIGO-API.
Thanks @plegall for your reply.
I have cleaned the cache and it now seems to work with the web API explorer.
Yes it was changed in the iOS app. The problem is that I used `X_PIWIGO_API` instead of `X-PIWIGO-API`.
<!-- github-comment-id:3626581306 -->
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.
Since I have upgraded to 16.1, calling API methods with API Keys in HTTP header returns HTTP 401 Access denied (it worked well with version 16.0).
To reproduce the issue:
The returned user status is guest.
Hi @EddyLB
It reminds me of https://piwigo.org/forum/viewtopic.php?pid=193631#p193631 : you need to clear your web browser case so that
tools/ws.htmuses the correct headerX-PIWIGO-APIthat replacesAuthorizationin version 16.1.0Now regarding your workflow: when you call
pwg.session.loginyou generate a server-side session and you get your cookie filled with the session id. If you callpwg.session.getStatuswithout providingX-PIWIGO-APIheader, you should get informations about the connected user in the current session.If you provide the
X-PIWIGO-APIheader when callingpwg.session.getStatus, Piwigo should use it instead of the session [... a few minutes later...] and it works fine, see my 2 screenshots:After I logged in as "plg2",
pwg.session.getStatuscorrectly saysusername="plg2".If I provide an
X-PIWIGO-APIheader with the apiKeyID:apiKeySecret, thenpwg.session.getStatuscorrectly saysusername="plg".@EddyLB did you change the header to
X-PIWIGO-APIin your iOS app?Thanks @plegall for your reply.
I have cleaned the cache and it now seems to work with the web API explorer.
Yes it was changed in the iOS app. The problem is that I used
X_PIWIGO_APIinstead ofX-PIWIGO-API.