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

pandiyan's avatar

TokenMismatchException in VerifyCsrfToken.php line 68

HI, i just copy the laravel project from my hosting site to my system (xampp).when i run application i faced that error.

Here my code,

<form class="form-horizontal" role="form" method="POST" action="{{ url('/login') }}">
                    {{ csrf_field() }}
                    <div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
                        <label for="email" class="col-md-4 control-label">E-Mail Address</label>
                        <div class="col-md-6">
                            <input id="email" type="email" class="form-control" name="email" value="{{ old('email') }}" required autofocus>
                            @if ($errors->has('email'))
                                <span class="help-block">
                                    <strong>{{ $errors->first('email') }}</strong>
                                </span>
                            @endif
                        </div>
                    </div>
                    <div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
                        <label for="password" class="col-md-4 control-label">Password</label>
                        <div class="col-md-6">
                            <input id="password" type="password" class="form-control" name="password" required>
                            @if ($errors->has('password'))
                                <span class="help-block">
                                    <strong>{{ $errors->first('password') }}</strong>
                                </span>
                            @endif
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-md-8 col-md-offset-4">
                            <button type="submit" class="btn btn-primary">
                                Login
                           </button>
                        </div>
                    </div>
                </form>

and i see the csrf token in the request parameters in web developer tool

please help

0 likes
4 replies
Nakov's avatar
Nakov
Best Answer
Level 73

@pandiyan when you copied the project, did you created your own .env file, and did you run php artisan key:generate?

Do you always get this error? Even if you try to register a User for example?

pandiyan's avatar

@nakov I copied the project today.already have .env file with project so i changed only APP_URL in env file.i din't run php artisan key:generate and i get this error always.

pandiyan's avatar

@nakov Thanks a lot , now its working,i did just run php artisan key:generate.

Please or to participate in this conversation.