Frage

I have two FB apps that I am using for local testing and production environments. In order to have these run, I have a local environment set up and a production environment (default for Laravel).

I have set up the local environment in my bootstrap/start.php file:

$env = $app->detectEnvironment(array(

    'local' => array('*Firstname*-*Lastname*-MacBook-Pro.local'),

));

I used the machine name of my laptop for my local environment (I am running it on MAMP).

Then in my Facebook OAuth2 Controller, I have:

public function getFacebook($provider) {      

        if(App::environment('local')) {
            return OAuth2::provider($provider, array('id' => 'appid1', 'secret' => 'appsecret1'));
        }
        else {
            return OAuth2::provider($provider, array('id' => 'appid2', 'secret' => 'appsecret2'));
        }

    }

However, when I run this on my local machine with MAMP, it is using appid2, appsecret2 (aka running the else and not reading the local environment).

I am missing something? Thank you for your help.

War es hilfreich?

Lösung

I don't think you have entered the right name for your local machine. In fact you have entered the local domain name linked to your machine.

To know your machine's name, open a terminal and enter what is after the "@" sign. You can also run the command cat /etc/hostname from a terminal.

For me I have got aaugusti@DellAntoine so I'll enter DellAntoine as my local machine name.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top