Highlighted

Not able to save user profile data due to CSRF token error

Avatar

Avatar

shardenduj76728

Avatar

shardenduj76728

shardenduj76728

24-10-2017

We are getting error while posting data using POST servlet on "Stage environment".

User are not able to save their profile data due to CSRF token error (PFA error log). We have created POST servlet in AEM to save profile data like profile image, about section etc.

Note: The above error is occurring occasionally.

Thanks,

csrf_error.pngcsrf_header.png

Replies

Highlighted

Avatar

Avatar

edubey

Total Posts

1.5K

Likes

264

Correct Answer

392

Avatar

edubey

Total Posts

1.5K

Likes

264

Correct Answer

392
edubey

24-10-2017

are you using OOTB cq.jquery to post data or using from your own clientlib?

Thanks

Highlighted

Avatar

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K
smacdonald2008

24-10-2017

Use AEM version of JQuery - it handles the token you need.

Highlighted

Avatar

Avatar

ompandeyy

Avatar

ompandeyy

ompandeyy

24-10-2017

If the request is coming from outside AEM(some third party application) then you can exclude the post servlet path in the CSRF filter configuration. Also, if you are using AEM 6.3 then you can configure Cross Origin configuration to allow requests(Post, put, delete) from trusted domains.

Highlighted

Avatar

Avatar

shardenduj76728

Avatar

shardenduj76728

shardenduj76728

24-10-2017

Yes, I am using OOTB cq.jquery which is included in clientlibs.

AEM version: AEM 6.1 SP1

Sometimes POST Servlet is not working due to 403 error in console, see below -

1332686_pastedImage_0.png