User tests: Successful: Unsuccessful:
Pull Request for Issue #45799
Correctly handle 401 Unauthorized errors when calling a webservice API with a wrong formed token instead of throwing a CRITICAL uncaught 500 server error.
The server responds with a 500 Internal Server Error. The PHP error log shows a CRITICAL error: Uncaught Throwable of type ValueError thrown with message "hash_hmac(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm".
throw a correct error 401 response.
Please select:
Documentation link for docs.joomla.org:
[x ] No documentation changes for docs.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed
| Status | New | ⇒ | Pending |
| Category | ⇒ | Front End Plugins |
| Title |
|
||||||
| Labels |
Added:
PR-5.4-dev
|
||
| Labels |
Added:
Webservices
|
||
I have tested this item ✅ successfully on 69203be
Tested JBT, PHP 8.4.13
TOKEN=c2hhMjU2OjE4OTo0NjFiZjIyMDE2NDM4NjFlYWIyMTIwZmU3OTM1NGU5NzJlNzM2MTJmNDZhYmRhOTRlNzZlYmQyMGE4NzU0MjMx
curl --header "X-Joomla-Token:$TOKEN" 'http://localhost:7054/api/index.php/v1/content/articles'
helloecho $TOKEN | base64 --decode | sed s/sha256/sha257/ | base64echo $TOKEN | base64 --decode | sed s/189/123/ | base64echo sha256:189: | base64echo sha256:189:4711 | base64| Status | Pending | ⇒ | Ready to Commit |
RTC
| Labels |
Added:
RTC
|
||
| Status | Ready to Commit | ⇒ | Fixed in Code Base |
| Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2025-10-23 14:45:42 |
| Closed_By | ⇒ | richard67 |
Thanks @MarcelSchuermann for that fix, and @alikon and @muhme for testing.
I have tested this item ✅ successfully on c7ba4f6
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/46305.