The MAC is invalid - DecryptException in BaseEncrypter.php line 48
Decryption is working fine on my production server and also on my other PC, but not on my laptop. All files are the same, the database is the same and the APP_KEY is the same in the .env file. I am using vagrant and homestead.
I have cleared artisan cache, composer cache, dumped the autoload, clear-compiled, emptied the browser cache and still nothing. I am using MCRYPT_RIJNDAEL_128 as the cipher in my config/app.php file.
The .env file is definitely being loaded and so is the APP_KEY. I can verify this using dd(env('APP_KEY')) in my routes file.
Any ideas?? I don't see why the same files, the same database and the same key work on one computer but not on the other.
Solved this. It took 6 hours but I decided to copy two lines from a working .env file into my laptops .env file in the hope that maybe there was unseen data hiding in the .env file, such as a space or a wrongly encoded character.
The APP_KEY= and the APP_DEBUG= lines were the exact same to the naked eye but for some reason it works now. I'm not sure if it was a hidden bit of whitespace, but I'm pretty sure it wasn't as I tested that earlier. Is there any way the value for APP_KEY could have been corrupted in the .env yet still look the exact same on screen??
so pleased i found this post!! thank you @stuartcusack .....i had same issue, in the end i copied the whole line 'app_key' => '', from .env.php on production site to .env.local.php on local site and it worked straight away even though the actual key was the same and to the eye looked no different
I faced the same problem I didn't need to copy past my app key from other environment to solve it,
The problem was that I'm using cookies and they are encrypted. It looks like my browser kept some of the cookies files from older environment and that cookies were created with other app key so it is pretty clear that they cannot be decrypted with my new app key.
I solved the problem by removing all browser cookies related to the current domain for my app .
refresh and everything worked as usual .
if you are using new app key just make sure that nothing related to the old key is there in browser or database .