jeudi 7 janvier 2016

Laravel TokenMismatchExpection when posting from inside an iframe

I have a page running on http://some.example.com. This page have an iframe. The iframe source/contains a Laravel 5.2 base application.

My Laravel page URL "which is the source of the iframe" is http://ift.tt/1TIrWCG.

http://ift.tt/1TIrWCG has a form with a submit button. When a use clicks it, he/she hits another route on the same domain i.e. http://ift.tt/1ZdxPyN

But every time, I submit the form I get the following exception

TokenMismatchException in VerifyCsrfToken.php line 67:

Here is my form

    <form method="POST" action="http://ift.tt/1ZdxPyN" accept-charset="UTF-8" class="form">
<input name="_token" type="hidden" value="Dk6SN4WzO4brbvdnBO6JZ7e1lBGjmYz8GQJ1lYFo">
<input name="survey_id" type="hidden" value="10">
<input name="call_id" type="hidden" value="667">
<input name="pools" type="hidden">

<input name="alt_id_1" type="hidden" value="250">
<input name="alt_id_2" type="hidden" value="5">
<input name="alt_id_3" type="hidden">
<input name="alt_id_4" type="hidden">
<input name="alt_id_5" type="hidden">
<input name="alt_id_6" type="hidden">
<input name="alt_id_7" type="hidden">
<input name="alt_id_8" type="hidden">
<input name="alt_id_9" type="hidden">
<input name="alt_id_10" type="hidden">


<input name="alt_string_1" type="hidden">
<input name="alt_string_2" type="hidden">
<input name="alt_string_3" type="hidden">
<input name="alt_string_4" type="hidden">
<input name="alt_string_5" type="hidden">
<input name="alt_string_6" type="hidden">
<input name="alt_string_7" type="hidden">
<input name="alt_string_8" type="hidden">
<input name="alt_string_9" type="hidden">
<input name="alt_string_10" type="hidden">

<div class="text-center"> 
    <input class="btn btn-primary" type="submit" value="Start Survey">
</div>

</form>

The form works perfectly outside of the iframe. The problem only happens when I am inside the iframe.

What could be causing this issue? How can I correct the problem?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire