Belal Khan
Belal Khan

Reputation: 148

Laravel 6 Showed 419 | page expired

In a local server the following laravel project working fine, But When the project upload on online server it's showing the problem.

When trying to login then its show:

419 | page expired.

I have cleared route, view, cache, and config when I uploaded it on online serve.

Upvotes: 6

Views: 16687

Answers (5)

Justin Russell
Justin Russell

Reputation: 1103

In case you're using the database driver for your sessions and either UUIDs or ULIDs for your user IDs, make sure the user_id field in the sessions table reflects the correct format. If it's a bigint unsigned field, it'll cause 419 errors if you're using ULIDs or UUIDs.

Upvotes: 0

agm1984
agm1984

Reputation: 17132

There's also the SESSION_LIFETIME key in your .env file.

It refers to the number of minutes to hold the session active, in minutes.

I had issues with mine set to 1 minute for testing, and then I forgot about it, so my CSRF would expire quickly while filling out forms.

I set it to 60 minutes to fix:

SESSION_DRIVER=file
SESSION_LIFETIME=60

Upvotes: 1

konz laugoko
konz laugoko

Reputation: 79

Just put {{ csrf_field() }} like others have said above, below login form, Laravel does not allow request forgery attacks.

Upvotes: 2

A.G.
A.G.

Reputation: 324

Your error seems to be related to 'csrf_token'. Either it is missing the csrf token or your route needs to be put in the exclusion list. See laravel doc for help.

Upvotes: 2

Imran
Imran

Reputation: 4750

We get this error page when CSRF token get expired. This issue generally happens when you load a page with form(eg. login page, registration page) then after a long time you submit the form. We get this because, the CSRF is expired by the time.

To solve this:

You can increase the lifetime in the config/session.php file.

Upvotes: 1

Related Questions