XWiki version: 16.10.17 (self-hosted)
Issue: I’m trying to create/update pages via the XWiki REST API using an OAuth2 Bearer token generated through XWiki’s Application/API token page (tied to an account with full admin rights). GET requests work perfectly, but PUT requests to the same space consistently fail with 401 Unauthorized.
What I’ve tested and ruled out:
- Confirmed the token is valid — GET requests using the exact same Authorization header succeed and return correct data.
- Reproduced the failure identically across three separate tools: curl, Postman, and n8n (an automation platform) — ruling out any client-specific issue.
- Tested with and without a request body (form-urlencoded with
title/contentfields, and also with no body at all) — same 401 either way. - Tested with the
XWiki-Form-TokenCSRF header included (obtained from a prior GET response, per the documentation) — no change in outcome. - Generated a completely new token and re-tested — same 401.
- Confirmed the account has full admin rights, and even explicitly verified/added Edit rights via the space’s Users & Rights panel.
- URL structure matches the documented pattern exactly:
/rest/wikis/xwiki/spaces/{space}[/spaces/{nestedSpace}]*/pages/{pageName}, confirmed valid since GET against the identical URL succeeds.