dev-master
9999999-deva phalcon component to implement social logins
MIT
The Requires
- php >=5.4.0
- guzzlehttp/guzzle ~6.0
by Dev Ratna Upadhyaya
socialite phalcon social-login phalcon-social
Wallogit.com
2017 © Pedro Peláez
a phalcon component to implement social logins
Social Login Wrapper for Phalcon (Based on Laravel's Socialite), (*1)
composer require dev-ratna/phalcon-social
the wrapper by deafault searches for social key in the main config file., (*2)
the config should use keys facebook, google or depending on the alias of the provider., (*3)
'social' => [
'facebook' => [
'client_id' => 'client-id-here',
'client_secret' => 'client-secret-here',
'redirect_uri' => 'url/to/redirect'
],
'google' => [
'client_id' => 'example-id',
'client_secret' => 'example-secret',
'redirect_uri' => 'url/to/redirect'
]
]
The Service, (*4)
use PhalconSocial\PhalconSocial;
$di->setShared('socialLogin', function(){
$socialLogin = new SocialLogin();
return $socialLogin;
});
The routes, (*5)
$router->add('/social/oauth/redirect', [
'controller' => 'controller',
'action' => 'redirect'
]);
$router->add('/social/oauth/login', [
'controller' => 'controller',
'action' => 'login'
]);
In the Controller, (*6)
<?php
namespace Namespace\Controllers;
class Controller extends ControllerBase
{
public function redirectAction()
{
$this->socialLogin->useProvider('google')->redirect();
}
public function loginAction()
{
$user = $this->socialLogin->useProvider('google')->authorize()->user();
}
}
In works., (*7)
a phalcon component to implement social logins
MIT
socialite phalcon social-login phalcon-social