Laravel 5: Decryption error The Mac is invalid - laravel

When i try to login the following error produced:
DecryptException in BaseEncrypter.php line 49:
The MAC is invalid.
I am using xampp with php 7.
The laravel version that i use is 5.2.
*I have change the api key running php artisan key:generate.
**I have trying the following commands: php artisan cache:clear composer dump-autoload composer update with no lucky.
I have clear the history of the browser.
** Here are the values of some variables:
iv=a69g/gRfyCNWTaKeuZ2Kkw==
value=C7DfTHbFWfZq0km633uXMX0ZRd1fuzcFFBgP0vtZj/d4C4Z3btgeFlmU2a1C9TdUlUDof4mnoGhdvEeB/gL1TQ==
mac=c0460e4ea3d724631cf4a12b7b19a5e512ecec8f492b4754e183714cc9d0a05c
Any help would be usefull.
Thanks in advance.

I know this is a little late but it might be useful for future me or someone else.
I had an issue where I had to encrypt something in the database, changed the APP_KEY and then tried to decrypt it and this error happened.

It was an error on redis server.
Hope that someone will help.

There might be some issue with the .env file as I am having the same problem.
There should be space between APP_KEY and APP_DEBUG

I could find a solution I tried everything including regenerating. However, this worked for me... If you have an existing app_key (in another folder/locally) you may want to restore, you can update it in the .env file manually. Locate the APP_KEY entry in the file and replace the value with the key in your initial .env in your previous project

Related

DigitOcean - laravel 8 deployment through Github (error 500)

I deployed the laravel app to digitalocean:
but I don't understand why is it showing error 500??
I connected a github repo to deploy it to digitalocean.
1- I set the build commands to: composer install
2- environment variables are set: APP_NAME, APP_URL, APP_KEY, DATABASE_URL, APP_DEBUG
This is how the repo looks (private)
What seems to be the issue??
I just did check the repo and it seems the vendors folder not there and your build steps look like a typo issue so please run below command
composer install
Still you face the issue then refer the laravel logs for that what went wrong
you also dont have a .env file
maybe copy the .env.example to .env
perhaps follow the instructions on the laravel site for the version you are using.
in your question, you have spelt 'install' incorrectly
turns out there were typos of lower and upper cases in controllers according to the laravel log.
I fixed them and now the site is running. It's weird that these typos didn't trigger erorrs locally..
All You have to do is configure the .env file if u have a .example.env edit the file to .env if u dont have it just try to create one or clone one from another project and do composer install but don't forget to generate a key with php artisan key:generate in the end

How to fix this error "Impossible to connect, please check your Algolia Application Id"?

I have everything correct, as written at laravel/algolia websites.
I tried to read lot of documentations and tutorials about Laravel Scout installation, but still can't find solution.
I have everything correct in my settings and also APIs are correct but still getting this error:
Impossible to connect, please check your Algolia Application Id.
I had the same issue (with Windows 10) and found this exception in the stack trace:
cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)
I found the solution for the error above in another StackOverflow post:
1) Download the latest cacert.pem from
https://curl.haxx.se/ca/cacert.pem
2) Add the following line to php.ini (if this is shared hosting and
you don't have access to php.ini then you could add this to .user.ini
in public_html)
curl.cainfo="/path/to/downloaded/cacert.pem"
Make sure you enclose the path within double quotation marks!!!
It solved my problem, Laravel Scout is working fine after that. Hope this will help someone.
Apparently on the issue came from on wrong credentials, this can occurs providing the wrong Application ID or Admin API Key. Also the correct way to provide the credential on scout.php is :
'algolia' => [
'id' => env('ALGOLIA_APP_ID', ''),
'secret' => env('ALGOLIA_SECRET', '')
],
And then fill your credentials in your .env file.
I'd recommend you to run php artisan config:clear in case you have cached your configuration (which you shouldn't do in dev env).
Let us know if it solve your issue.
I had the same issue and solved it like this
php artisan cache:clear
php artisan route:clear
php artisan config:clear or config:cache
My assumption is, because Laravel always creates a cache in the config, every time we change some config, there must be another config that is broken or an error due to the cache that was created earlier.
But I don't know for sure.
I share with you my experience.
System was Vagrant Homestead with VirtualBox in Windows 10.
command used in CMD:
php artisan scout:import "App\Post"
command failed with:
Impossible to connect, please check your Algolia Application Id.
Logged into virtual box with vagrant ssh and gave it another try.
That solved my problem.

Whoops, looks like something went wrong. on server

I uploaded all laravel project on server, its working fine on local but getting error on server, even database configuration and key is configured in env. file. even i renamed .env.example file as .env too but got same error.
Error is
"Whoops, looks like something went wrong."
my error log is here:
[2017-11-06 15:19:07] local.ERROR: exception 'RuntimeException' with
message 'The only supported ciphers are AES-128-CBC and AES-256-CBC
with the correct key lengths.' in
/home/rndspot5/public_html/dev/lea/vendor/laravel/framework/‌​src/Illuminate/Encry‌​ption/Encrypter.php:‌​43
Judging from your error, you need to run php artisan key:generate this will update your key of which in turn will rectify your error.
You will need to either SSH into your public_html folder if you have host permission to do so. Alternatively, you can ask your host provider to either:
Grant you SSH access
Perform this action for you.
You can then run: php artisan config:clear once the new key has been generated.
If you are on shared hosting you can use these steps
Open your .env file, copy APP_KEY to somewhere else as a backup
Run php artisan key:generate from console
Copy the new APP_KEY and upload it to the .env file on your (shared) server
Move the old key back to development
I resolved this issue, by adding web app url in .env and Config/App.php and now its working :) thanks all of you for sharing such a value able knowledge that will help me, may be later.

Laravel uploading to Heroku

Hello guys so I uploaded my app to Heroku. I want to mention that when I run php artisan:serve it all works fine without any problem but when I upload it to the heroku server I have a problem with the following error
The only supported ciphers are AES-128-CBC and AES-256-CBC with the correct key lengths.
Now I had the same error localy but I fixed it. now I can't seem to find how to fix it when I the app is uploaded. Any help would be appriciated. Thank you.
You need a key in your .env
php artisan key:generate
And make sure .env exists
As #EddyTheDove mentioned,
php artisan key:generate
This makes sure that the APP_KEY variable is set in the .env file. When you open the .env file, you should see the same key that was generated after you executed the command.
And make sure .env exists
This is located in your project folder.
ALSO:
Remember to use the ENTIRE key.
The "base64:" part of the generated key is also important, because it encodes the random string and provides an encryption key of the required length.

Trait 'Illuminate\Foundation\Auth\Access\AuthorizesResources' not found

Anyone familiar with this error i'm getting?
Please help thanks.
If you are using Laravel 5.3 do the following:
From the upgrade guides: The AuthorizesResources Trait
The AuthorizesResources trait has been merged with the AuthorizesRequests trait. You should remove the AuthorizesResources trait from your app/Http/Controllers/Controller.php file.
Seems like the problem is with your version of laravel/framework.. Running composer update should pull in the latest version (which is 5.2.39). If that doesn't work for you, then I'm not sure what else you can do. Perhaps try composer self-update before you do it.
If you run composer info laravel/framework the 4th line should show you the latest version from packagist, which is: 5.2.39.
Edit: You could try and clear your package cache: composer clearcache
Does Laravel connect to database? I had this error and it was caused by a wrong database configuration in .env file.
Try these settings in .env file:
1. Open .env file in your project's folder. Don't touch the .env.example file found in the same location as it's an example of .env default configuration. If something goes wrong with your .env file, you can copy and paste the configuration from the .env.example file to .env.
2. Change the following 4 lines to your own configuration:
DB_HOST=localhost
DB_DATABASE=forge
DB_USERNAME=forge
DB_PASSWORD=
DB_DATABASE It's the name of your database. Should be 'forge' by default or check your phpMyAdmin to determine which database you need to use. You can create a new database if you're an administrator of phpMyAdmin ('root' user).
DB_USERNAME This is your username when you log in to phpMyAdmin. Should be 'forge' by default.
DB_PASSWORD Your phpMyAdmin should not be protected with password by default. The password is set later manually. In case you'll set the password, add it to DB_PASSWORD line after you do so.
3. Save the modified .env file and restart the Apache server.
Try to access your webpage again. This worked for me. I hope it's gonna work for you, too.
P.S. If it doesn't work, check if the .env configuration is right for you. Or use php artisan config:clear to clear cache.

Resources