Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The mac is invalid laravel

Tags:

php

laravel

I got involved into a new laravel project and tryed running the unit tests (that pass on my friend's project), and I got some fails. I looked into the laravel.log and saw multiple times this one:

testing.ERROR: Illuminate\Contracts\Encryption\DecryptException: The MAC is invalid. in /mnt/c/xampp/htdocs/erx/vendor/laravel/framework/src/Illuminate/Encryption/BaseEncrypter.php:48

I tryed clearning the cache, and also running:
php artisan key:generate
but that didn't remove the problem. Is there anything else that I should try?

like image 837
jiwfeoi Avatar asked Oct 21 '25 01:10

jiwfeoi


2 Answers

Your APP_KEY is probably not the same as local/remote. Crypt::decryptString then throws MAC is invalid error.

You should be able to get rid of this when you clean cache and cookies in the browser.

Also make sure keys are same.

like image 141
Michal Avatar answered Oct 22 '25 16:10

Michal


I may happen when you setup on dev machine new instance and open a browser with one APP_KEY and then regenerated it and trying to refresh page.

If it's the case: try to clear cookies in the browser. It will wipe session and new one will be created automatically using newly created key.

like image 32
Yuriy Perevoznikov Avatar answered Oct 22 '25 16:10

Yuriy Perevoznikov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!