public function accesofb($social) { $cfg = Configuracion::getConfiguracion('social_login'); $app_id = ''; $app_secret = ''; $app_cb = ''; $url = ''; $oauthObj = null; if (isset($social) && $social == 'face') { $app_id = $cfg['FB_APP_ID']; $app_secret = $cfg['FB_APP_SECRET']; $app_cb = $cfg['FB_APP_CB']; $url = $cfg['FB_APP_INFO']; $oauthObj = new Facebook($app_id, $app_secret, $app_cb); } else { if (isset($social) && $social == 'twitter') { $app_id = $cfg['TW_APP_ID']; $app_secret = $cfg['TW_APP_SECRET']; $app_cb = $cfg['TW_APP_CB']; $url = $cfg['TW_APP_INFO']; $oauthObj = new Twitter($app_id, $app_secret, $app_cb); } else { if (isset($social) && $social == 'google') { $app_id = $cfg['GO_APP_ID']; $app_secret = $cfg['GO_APP_SECRET']; $app_cb = $cfg['GO_APP_CB']; $url = $cfg['GO_APP_INFO']; $oauthObj = new Google($app_id, $app_secret, $app_cb); } } } $scope = array('email'); $oauthObj->setScope($scope); if ($oauthObj->validateAccessToken()) { try { $response = $oauthObj->makeRequest($url); $this->verificarAutenticacion($social, $response); } catch (Exception $e) { echo $e; } } }