on ‎2025 Sep 23 5:24 AM
Hi,
I have a BTP react app which fetches data correctly from S4 backend through the approuter using destination. However when trying to do a post call, it needs a csrf token which it fetches correctly and passes to the Odata call correctly. However it fails giving with 403, token validation failed.
as recommended on another post, I maintained csrfprortection as false in xs-app.json as csrf token validation in my case is maintained by the backend only.
is there any other config I need to look into, maybe in the destination setvice in mta or the actual destination in BTP, or the destination user role?
Request clarification before answering.
A 403 Forbidden error in an SAP BTP POST call means the request was understood by the server, but the client (your Fiori or BTP application or a tool like Postman) lacks the necessary authentication or authorization to access the resource.
This can be A common security measure for POST, PUT, and DELETE requests in SAP systems is CSRF protection. The server requires a special token to prevent cross-site request forgery attacks.
Symptom: Your GET request works, but the POST request fails with a 403 error.
Cause: You're not including the x-csrf-token header in your POST request.
Solution: You must first make a GET request to the same endpoint with the header x-csrf-token: Fetch. The server will respond with the token in the response header. You then include this token in the header of your subsequent POST request.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 5 | |
| 5 | |
| 3 | |
| 3 | |
| 3 | |
| 3 | |
| 2 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.