Skip to Content
0

csrf token validation failed while using post method for c4c custom object in absl code

Feb 18 at 10:52 AM

194

avatar image

Hi Expert,

I am using post method to create a record in the c4c custom object but it is throwing csrf token validation failed error 403 . As suggested in other blogs i have used the get method and retrieved the csrf token and other parameter but not able to create record.

Can anyone can help me with this issue?

Thanks in advance.

Regards,

Abhishek

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Vignesh Dharmaraj Feb 20 at 05:59 AM
0

Hi Abhishek,

Even If you are passing the CSRF token in POST method which you got from GET request, C4C may understand that this GET and POST HTTPS requests originates from different client sessions so your CSRF token validation may fail when you implement it through your custom code.

Basically HTTP is a stateless protocol, to maintain the state between 2 HTTP requests you can use the cookies method.

Server cookies returned in GET request (as shown in attached Image) can be used to maintain the state in the subsequent POST request, then you can avoid the CSRF validation failure.

Regards,

Vignesh


Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi Vignesh,

Thanks for your response.

I tried to implement the same (fetch the cookie and csrf token value from the get method and set it to the post method) but it didn't work.

It is working using the postman tool but the same when I am trying to implement using the ABSL code it doesn't work.

Have you tried to post any data to the odata service of C4C?

Please let me know if you find anything ...

Regards,

Abhishek

0
Ambuja Prabhudessai Feb 19 at 09:00 AM
0

Hi,

I am also getting the same error when trying to post data using C4C odata REST service.

Regards,

Ambuja

Share
10 |10000 characters needed characters left characters exceeded