本文整理汇总了PHP中LinkedIn::authorize方法的典型用法代码示例。如果您正苦于以下问题:PHP LinkedIn::authorize方法的具体用法?PHP LinkedIn::authorize怎么用?PHP LinkedIn::authorize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LinkedIn
的用法示例。
在下文中一共展示了LinkedIn::authorize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: linkedInLogin
/**
* Function to Grant Access to Linkedin
* @author Rohan Julka
* */
public function linkedInLogin($userIdApp = null)
{
$userId = !empty($userIdApp) ? $userIdApp : $this->Session->read('Auth.Front.id');
$userIsConnected = $this->User->find('first', array('conditions' => array('User.id' => array($this->Encryption->decode($userId))), 'fields' => array('User.linkedin_connected')));
if (!empty($userIsConnected['User']['linkedin_connected'])) {
$this->Session->setFlash('Your LinkedIn account has already been linked', 'Front/flash_good');
if (!empty($userIdApp)) {
$this->redirect('foxhoprapplication://alreadylinkedin');
} else {
return $this->redirect(array('controller' => 'businessOwners', 'action' => 'social', 'linkedIn'));
}
}
if (!empty($userIdApp)) {
$this->Session->write('Auth.Front.id', $userIdApp);
$this->Session->write('AccessedBy', 'WebService');
}
require_once ROOT . DS . APP_DIR . DS . 'Plugin/linkedin/linkedin.php';
$ln = new LinkedIn(Configure::read('linkedinApiKey'), Configure::read('linkedinApiSecret'), Configure::read('SITE_URL') . 'businessOwners/linkedInOauthCallback', array('w_share', 'r_basicprofile'));
if ($ln->authorize()) {
$ln->resetToken();
$ln->authorize();
echo 'authorized';
} else {
echo 'not authorized';
}
$this->autoRender = false;
}