Error : The MAC is invalid Question's And Solutions [Solved]

  • 23-06-2022
  • 1471
  • Laravel 9
  • Haresh Chauhan

The problem occurs when you generated new APP_KEY in your laravel application or when you change your laravel application .env file.

The APP_KEY is very important in your laravel application. without this key you can not able to open your application. You must need to generate "KEY". Then your application will run.

The command of key generate is :

php artisan key:generate

So Next, If you are facing MAC is invalid error when you trying to open your laravel application. So i will give you solution for that.

Before that, I want to ask some Questions :

  • Have You Change Your .env file?
  • Have You Generated New Your APP_KEY using Command?
  • Have You Made Any Changes/Replaced In APP_KEY?
  • The Encrypted Value, You Made Any Changes?
  • Have Your Copy Of The Data Value From Other Which You Try To Decrypt?
  • The Variable Value Is Null Or Not Encrypted?

If Your answer is "YES" then please follow the below solution.

The MAC is invalid

Below Solution will help you to slove your problem.

SOLUTION 1 :

Please add Old APP_KEY As it is Before you used. If you have!.

SOLUTION 2 :

You can again Encrypt your value which you trying to Decrypt old encrypted value with new APP_KEY.

SOLUTION 3 :

Make Sure Your Production and Staging APP_KEY in the .env file are the same.

SOLUTION 4 :

Make sure the variable value that you trying to Decrypt is NOT NULL.

SOLUTION 5 :

Check the value of the variable which you trying to Decrypt is Encrypted Before.

SOLUTION 6 :

Encrypt that value with new APP_KEY.


We always thanks to you for reading our blogs.


dharmesh-image

Dharmesh Chauhan

(Swapinfoway Founder)

Hello Sir, We are brothers origin from Gujarat India, Fullstack developers working together since 2016. We have lots of skills in web development in different technologies here I mention PHP, Laravel, Javascript, Vuejs, Ajax, API, Payment Gateway Integration, Database, HTML5, CSS3, and Server Administration. So you need our service Please Contact Us

haresh-image

Haresh Chauhan

(Co-Founder)


We Are Also Recommending You :