Пример #1
0
 public function onSloginAuth()
 {
     $redirect = JURI::base() . '?option=com_slogin&task=check&plugin=linkedin';
     $app = JFactory::getApplication('site');
     # First step is to initialize with your consumer key and secret. We'll use an out-of-band oauth_callback
     $linkedin = new LinkedIn($this->params->get('api_key'), $this->params->get('secret_key'), $redirect);
     //$linkedin->debug = true;
     # Now we retrieve a request token. It will be set as $linkedin->request_token
     $linkedin->getRequestToken();
     if (empty($linkedin->request_token)) {
         echo 'Error - empty access tocken';
         exit;
     }
     $app->setUserState('requestToken', serialize($linkedin->request_token));
     $url = $linkedin->generateAuthorizeUrl();
     return $url;
 }
Пример #2
0
 public function onSloginAuth()
 {
     if ($this->params->get('allow_remote_check', 1)) {
         $remotelUrl = JURI::getInstance($_SERVER['HTTP_REFERER'])->toString(array('host'));
         $localUrl = JURI::getInstance()->toString(array('host'));
         if ($remotelUrl != $localUrl) {
             die('Remote authorization not allowed');
         }
     }
     $redirect = JURI::base() . '?option=com_slogin&task=check&plugin=linkedin';
     $app = JFactory::getApplication('site');
     # First step is to initialize with your consumer key and secret. We'll use an out-of-band oauth_callback
     $linkedin = new LinkedIn($this->params->get('api_key'), $this->params->get('secret_key'), $redirect);
     //$linkedin->debug = true;
     # Now we retrieve a request token. It will be set as $linkedin->request_token
     $linkedin->getRequestToken();
     if (empty($linkedin->request_token)) {
         echo 'Error - empty access tocken';
         exit;
     }
     $app->setUserState('requestToken', serialize($linkedin->request_token));
     $url = $linkedin->generateAuthorizeUrl();
     return $url;
 }
Пример #3
0
 public function linkedin()
 {
     session_start();
     $this->load->helper('url');
     $this->load->library('linkedin');
     $config['base_url'] = base_url('home/linkedin');
     $config['callback_url'] = base_url('home/demo');
     $config['linkedin_access'] = '752gpjkt6d55ne';
     $config['linkedin_secret'] = 'y9VajltKjmVYRfXw';
     # First step is to initialize with your consumer key and secret. We'll use an out-of-band oauth_callback
     $linkedin = new LinkedIn($config['linkedin_access'], $config['linkedin_secret'], $config['callback_url']);
     //$linkedin->debug = true;
     # Now we retrieve a request token. It will be set as $linkedin->request_token
     $linkedin->getRequestToken();
     $_SESSION['requestToken'] = serialize($linkedin->request_token);
     # With a request token in hand, we can generate an authorization URL, which we'll direct the user to
     //echo "Authorization URL: " . $linkedin->generateAuthorizeUrl() . "\n\n";
     header("Location: " . $linkedin->generateAuthorizeUrl());
 }
Пример #4
0
<?php

session_start();
include 'lib/myclass.php';
$config['base_url'] = $obj->SITEURL . 'acesslinkeddata.php';
$config['callback_url'] = $obj->SITEURL . 'demo.php';
$config['linkedin_access'] = '75vkqc3tq7hrwp';
$config['linkedin_secret'] = 'VpK3l3fMS3hMna7f';
include_once "linkedin.php";
# First step is to initialize with your consumer key and secret. We'll use an out-of-band oauth_callback
$linkedin = new LinkedIn($config['linkedin_access'], $config['linkedin_secret'], $config['callback_url']);
//$linkedin->debug = true;
# Now we retrieve a request token. It will be set as $linkedin->request_token
$linkedin->getRequestToken();
$_SESSION['requestToken'] = serialize($linkedin->request_token);
# With a request token in hand, we can generate an authorization URL, which we'll direct the user to
//echo "Authorization URL: " . $linkedin->generateAuthorizeUrl() . "\n\n";
header("Location:" . $linkedin->generateAuthorizeUrl());
Пример #5
0
 public function get_linkedin_url()
 {
     $config['base_url'] = base_url('auth/get_linkedin_url');
     $config['callback_url'] = base_url('auth/linkedin_login');
     $config['linkedin_access'] = '78iwuorjnrw04c';
     $config['linkedin_secret'] = 'J05AYZ236vVmIc3e';
     $linkedin = new LinkedIn($config['linkedin_access'], $config['linkedin_secret'], $config['callback_url']);
     $linkedin->getRequestToken();
     $_SESSION['requestToken'] = serialize($linkedin->request_token);
     echo $linkedin->generateAuthorizeUrl();
 }
Пример #6
0
function ln_page1($prefix, $message)
{
    //configuration parameters:
    $config_params = Config::getConfigParams();
    $hostname = $config_params['hostname'];
    $linkedin_access = $config_params['linkedin_access'];
    $linkedin_secret = $config_params['linkedin_secret'];
    $docroot = $config_params['docroot'];
    $debug = $config_params['debug'];
    $script_path = __FUNCTION__;
    if (session_id() == "") {
        session_start();
    }
    include_once $docroot . "/linkedin/linkedin.php";
    $config['base_url'] = "{$hostname}/linkedin/page1.php";
    $config['callback_url'] = "{$hostname}/linkedin/page2.php";
    $config['linkedin_access'] = $linkedin_access;
    $config['linkedin_secret'] = $linkedin_secret;
    logger($script_path . "  Ln/Top: ");
    # First step is to initialize with your consumer key and secret. We'll use an out-of-band oauth_callback
    $linkedin = new LinkedIn($config['linkedin_access'], $config['linkedin_secret'], $config['callback_url']);
    //$linkedin->debug = true;
    # Now we retrieve a request token. It will be set as $linkedin->request_token
    $linkedin->getRequestToken();
    logger($script_path . "  request_token: ", $linkedin->request_token);
    $_SESSION['requestToken'] = serialize($linkedin->request_token);
    $_SESSION['message'] = $message;
    //
    $_SESSION['prefix'] = $prefix;
    # With a request token in hand, we can generate an authorization URL, which we'll direct the user to
    header("Location: " . $linkedin->generateAuthorizeUrl());
    exit;
}
Пример #7
0
<?php

require_once 'linkedin.php';
include dirname(__FILE__) . "/../../ms_configura.php";
$consumer_key = $linkedinoauth["consumerkey"];
$consumer_secret = $linkedinoauth["consumersecret"];
echo "<pre>";
# First step is to initialize with your consumer key and secret. We'll use an out-of-band oauth_callback
$linkedin = new LinkedIn($consumer_key, $consumer_secret, "oob");
$linkedin->debug = true;
# Now we retrieve a request token. It will be set as $linkedin->request_token
$linkedin->getRequestToken();
# With a request token in hand, we can generate an authorization URL, which we'll direct the user to
echo "Authorization URL: " . $linkedin->generateAuthorizeUrl() . "\n\n";
# After logging in, the user will be presented with an OAuth Verifier, which you would then ask the member to enter in a UI you present. Once you have the OAuth verifier, set it here:
echo "Enter OAuth Verifier:\n";
$handle = fopen("php://stdin", "r");
$oauth_verifier = trim(fgets($handle));
$linkedin->getAccessToken($oauth_verifier);
# You now have a $linkedin->access_token and can make calls on behalf of the current member
$xml_response = $linkedin->getProfile("~:(id,first-name,last-name,headline,picture-url)");
echo $xml_response;
# Let's set our status
$xml_response2 = $linkedin->setStatus("setting my status using the LinkedIn API.");
echo $xml_response2;
# Let's do a search!
$search_response = $linkedin->search("?company=Google&count=10");
echo $search_response;