duanjianxi8439 2017-05-24 12:58
浏览 42

Laravel 5.4 TokenMismatchException

Everything was working find but suddenly I got this error TokenMismatchException in VerifyCsrfToken.php line 68:

What I have tried

I have checked my form and I used the {!! csrf_field() !!} also I used <meta name="csrf-token" content="{{ csrf_field() }}" /> and also both matches..

Please check the login at this website and type any login information and you will see the error. http://egypt-pets.com/login

Form Code

 {{ Form::open(['route' => 'login', 'class' => 'form-signin', 'method' => 'post']) }}
         <h3 class="form-signin-heading">Welcome Back! Please Login</h3>
         <hr class="colorgraph"><br>
         {{ Form::label('email', 'Email: ') }}
         <input type="text" class="form-control" name="email" placeholder="example@example.com" required="" autofocus="" />

         {{ Form::label('password', 'Password: ', ['class' => 'margin-top-20']) }}
         <input type="password" class="form-control" name="password" placeholder="******" required=""/>

         <div class="checkbox">
            <label>
                <input style="width: 16px; margin-top: -11px;" type="checkbox" name="remember" {{ old('remember') ? 'checked' : '' }}> Remember Me
            </label>
        </div>

        <button class="btn btn-lg btn-success btn-block"  name="Submit" value="Login" type="Submit"><i class="fa fa-user-o"></i> Login</button>
        <a class="btn btn-link" href="{{ route('password.request') }}">
            Forgot Your Password?
        </a>
        <a class="btn btn-link pull-right" href="{{ route('register') }}">
            Doesn't have an account?
        </a>
        <a href="login/facebook" class="btn btn-primary btn-block btn-lg margin-top-20" style="background-color: #3B5998"><i class="fa fa-facebook" style="margin-right: 10px"></i> Login In With Facebook</a>
{{ Form::close() }}

I didn't use {{ csrf_field() }} because I used HTML helped which already put it.. And I have also tried to use the normal form and use {{ csrf_field() }} and got the same error

  • 写回答

2条回答 默认 最新

  • dongsuiying7773 2017-05-24 13:09
    关注

    First remove {!! csrf_field() !!} and <meta name="csrf-token" content="{{ csrf_field() }}" />

    Then follow following steps

    In your form:

    after <form> tag

    add following

    {{ csrf_field() }}


    评论

报告相同问题?

悬赏问题

  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)