hybrid error redirect_uri_mismatch google

I was working on a project involving HybridAuth and after google for a long time; I was not lucky. Finally I tried trial and error technique and found that to fix this error, the base_url in the code (config.php) should be like:

   "base_url" => "http://localhost/hybrid/index.php",

And for google developers console the ‘Redirect URIs’ must be:

   http://localhost/hybrid/index.php?hauth.done=Google 

yii2 vagrant directory assets is not writable

The vagrant shares the code folder as NFS (Network file share) on the guest machine and therefore you cannot change the permissions of the vagrant or assets directory inside guest machine using local file permissions eg chmod etc.

There are two solutions.
1. Add user www-data (apache is run under this) to vagrant group by using command:


       sudo usermod -a -G vagrant www-data

   

2. Change apache file /etc/apache2/envvars so that apache runs under user/group vagrant.

     sudo nano /etc/apache2/envvars

   

Find line

 export APACHE_RUN_USER=www-data 

and change it to:

 export APACHE_RUN_USER=vagrant 

Restart apache2

 sudo service apache2 restart