Archived
1
0
Fork 0

app/config/services.php: setup "oauth" using the new implementation

This commit is contained in:
Henrik Hautakoski 2018-04-06 11:40:35 +02:00
parent b3eb25d221
commit f966cfb911

View file

@ -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) {