From 8e303d0f56439129736afc1e2a13382b79ec4683 Mon Sep 17 00:00:00 2001 From: Vincent Klaiber Date: Thu, 27 Nov 2014 11:15:24 +0100 Subject: [PATCH] Add callback url to the configuration file. --- .../Instagram/InstagramServiceProvider.php | 16 ++++++++++++--- src/config/config.php | 20 ++++++++++++++++--- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/src/Vinkla/Instagram/InstagramServiceProvider.php b/src/Vinkla/Instagram/InstagramServiceProvider.php index 9ed3410..0cce1c8 100644 --- a/src/Vinkla/Instagram/InstagramServiceProvider.php +++ b/src/Vinkla/Instagram/InstagramServiceProvider.php @@ -21,13 +21,22 @@ public function register() // Register 'Instagram' instance container to our Instagram object. $this->app->bindShared('Vinkla\Instagram\Contracts\Instagram', function($app) { - return new Instagram( + if ( + empty($app['config']['instagram::client_secret']) && + empty($app['config']['instagram::callback_url']) + ) + { + return new Instagram($app['config']['instagram::client_id']); + } + + return new Instagram([ $app['config']['instagram::client_id'], $app['config']['instagram::client_secret'], - $app['config']['instagram::callback'] - ); + $app['config']['instagram::callback_url'] + ]); }); } + /** * Bootstrap the application events. * @@ -37,6 +46,7 @@ public function boot() { $this->package('vinkla/instagram'); } + /** * Get the services provided by the provider. * diff --git a/src/config/config.php b/src/config/config.php index e281145..f9c09d7 100644 --- a/src/config/config.php +++ b/src/config/config.php @@ -8,7 +8,8 @@ |-------------------------------------------------------------------------- | | Your applications client identifier. Used when generating authentication - | tokens and to receive your authorization code. The client identifier + | tokens and to receive your authorization code. This must always be set + | to fetch data from Instagram. | */ @@ -20,10 +21,23 @@ |-------------------------------------------------------------------------- | | Your applications client secret. Used when generating authentication - | tokens and to receive your authorization code. + | tokens and to receive your authorization code. Leave this NULL if you + | only are going to fetch public data. | */ - 'client_secret' => '' + 'client_secret' => null, + + /* + |-------------------------------------------------------------------------- + | Callback URL + |-------------------------------------------------------------------------- + | + | Your applications callback url. Used to authorize users and generating + | tokens. Leave this NULL if you only are going to fetch public data. + | + */ + + 'callback_url' => null ];