XF 2.1 How can I disable the CSRF protection?

researcher

Member
Hey, how are you?
I have just created a page in XF but while I am trying to send a POST request, I get this error:
Security error occurred. Please press back, refresh the page, and try again.

I think this error causes because of CSRF protection. How can I disable the CSRF protection in my custom page? (I have PHP callback)

Thanks.
 
I was running on /forum/pages/xxxx --- and I have just solved.
PHP:
$csrftoken = \XF::app()->get('csrf.token');
echo '<input type="hidden" name="_xfToken" value="'.$csrftoken.'">';

just add $csrftoken in your form with "_xfToken" name.

Where are you generating POST - outside of XenForo?
Do you have access to the cookies?
 
Back
Top Bottom