From f966cfb9115439865d6b05dd0a4e26caef327cc9 Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Fri, 6 Apr 2018 11:40:35 +0200 Subject: [PATCH] app/config/services.php: setup "oauth" using the new implementation --- app/config/services.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/app/config/services.php b/app/config/services.php index 0193e1f..3e12006 100644 --- a/app/config/services.php +++ b/app/config/services.php @@ -24,7 +24,8 @@ use Phalcon\Di\FactoryDefault, Phalcon\Mvc\Router; use Httpcb\Auth, - Httpcb\OAuth, + Httpcb\OAuth\Client as OAuthClient, + Httpcb\OAuth\Adapter\League as OAuthAdapter, Httpcb\Acl, Httpcb\Navigation, Httpcb\Menu; @@ -294,8 +295,18 @@ $di->setShared('flash', function () { return new Phalcon\Flash\Session(); }); -$di->set('oauth', function() use ($config) { - return new OAuth($config); +$di->set('oauth', function($provider) use ($config) { + + if (isset($config->oauth->providers->{$provider})) { + $options = $config->oauth->providers->{$provider}; + $options = $options->toArray(); + } else { + $options = array(); + } + + $adapter = new OAuthAdapter($provider, $options); + + return new OAuthClient($adapter); }); $di->set('auth', function() use ($di, $config) {