1

I m working on laravel login and everything works fine in localhost but when i moved to live server its throwing page expired error even though i have added csrf token

My form is like this

 <form  method="POST" action="{{ route('login') }}" role="form">
                    {{ csrf_field() }}
                    <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

                    <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

                    <button type="submit" class="btn btn-green">Sign in</button>
                </form>

I have tried clearing server cache with php artisan cache:clear and restarting my apache 2 server I have also tried to clear session in config/framework/session folder and also in config.framework/views

Even though it still persist

Can anyone please help me ??? Thank you

4
  • do you have .env file ? Commented Feb 10, 2018 at 8:11
  • yes i have .env file Commented Feb 10, 2018 at 8:34
  • 1
    execute php artisan key:generate and check what happens then. Commented Feb 10, 2018 at 10:14
  • yes i did no help :/ Commented Feb 10, 2018 at 10:29

1 Answer 1

3

Are your session cookies set to secure? in config/session.php make sure 'secure'=>false if you are not using https.

Sign up to request clarification or add additional context in comments.

5 Comments

Sounds like the session cannot be saved. Can you verify if apache can write to the session directory storage/framework/sessions. that is if you are using the file driver for sessions
Yes it has read write and excution permission i changed it permission using chmod –R 777 sessions and its current persmission showing – rw– r–– r– –
can you verify the session is working? does the token change each time you re-load the form? can you post what you have in your config/session.php? also any .env variables starting with SESSION_.
no the token value does not change on page loading apparently it seems to be same even after refreshing the page In session file i have this ` 'secure' => env('SESSION_SECURE_COOKIE', false), ` along with other laravel default setting i didn't change anything in .env i have this SESSION_DRIVER=file nothing else with prefix SESSION_
ok sessions are working. maybe try to clear your cookies and try again. If you have changed the application key in your .env file could cause the problem. Also verify the time on the server is correct.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.