Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

pratikkaje's avatar

TokenMismatchException

I am learning Laravel 5. I created a page with post request. The page has few fields for data input and a submit button. This page is hosted on server A. There is another server, server B which hosts another site. I have embeded post request page from server A website into server B website using an iframe. Though most of the time post request works fine; it fails sometimes. When I checked error log, it showed me TokenMismatchException error. Is this because of cross site request forgery?

exception 'Illuminate\Session\TokenMismatchException' in /var/www/TenantPortal/storage/framework/compiled.php:1626
0 likes
4 replies
pmall's avatar

The purpose of the csrf protection is to forbid a post/put/delete request to come from another website.

pratikkaje's avatar

@pmall Thank for your response but I am confused here. Is it really a request coming from another site? My page is just embedded in iframe of other server website. The iframe has link to my page.

bobbybouwmann's avatar
Level 88

The iframe is loading a view from another site so basically it's another site!

Please or to participate in this conversation.