summaryrefslogtreecommitdiffstats
path: root/includes/OAuth/.svn/pristine/82
diff options
context:
space:
mode:
authorBlueRaja <BlueRaja.admin@gmail.com>2013-06-01 20:10:36 -0500
committerBlueRaja <BlueRaja.admin@gmail.com>2013-06-01 20:10:36 -0500
commit951330c9f83c8c8ee98f65fdccb5797e2e59d1f3 (patch)
treefc7b196ca0d91c1c71dcd945aa9667c7af0134fa /includes/OAuth/.svn/pristine/82
parente58a3b8b3702b22c903b02a9b4fa1020d6797459 (diff)
downloadpathery-951330c9f83c8c8ee98f65fdccb5797e2e59d1f3.tar.xz
A partial commit of the auth stuff, in case my upcoming changes break anything
Diffstat (limited to 'includes/OAuth/.svn/pristine/82')
-rw-r--r--includes/OAuth/.svn/pristine/82/826c340a0ca450577bc1ca6e98ced10653f7da2c.svn-base36
1 files changed, 36 insertions, 0 deletions
diff --git a/includes/OAuth/.svn/pristine/82/826c340a0ca450577bc1ca6e98ced10653f7da2c.svn-base b/includes/OAuth/.svn/pristine/82/826c340a0ca450577bc1ca6e98ced10653f7da2c.svn-base
new file mode 100644
index 0000000..b72e20a
--- /dev/null
+++ b/includes/OAuth/.svn/pristine/82/826c340a0ca450577bc1ca6e98ced10653f7da2c.svn-base
@@ -0,0 +1,36 @@
+<?php
+
+class LinkedIn extends Oauth {
+
+ protected $_prefix = 'linkedin';
+ protected $_authorize_url = 'https://www.linkedin.com/uas/oauth/authorize';
+ protected $_access_token_url = 'https://api.linkedin.com/uas/oauth/accessToken';
+ protected $_request_token_url = 'https://api.linkedin.com/uas/oauth/requestToken';
+
+ public function requestAccessToken($method = 'GET', Array $params = array(), $returnType = 'flat', Array $values = array('oauth_token', 'oauth_token_secret')){
+ $response = $this->makeRequest($this->_access_token_url, 'POST', array(), $returnType, false, true);
+
+ if($returnType != 'json'){
+ $r = explode('&', $response);
+ $params = array();
+ foreach($r as $v){
+ $param = explode('=', $v);
+ $params[$param[0]] = $param[1];
+ }
+ } else {
+ $params = $response;
+ }
+
+ if(isset($params[$values[0]]) && isset($params[$values[1]])){
+ $_SESSION[$this->_prefix]['access_token'] = $params[$values[0]];
+ $_SESSION[$this->_prefix]['access_token_secret'] = $params[$values[1]];
+ } else {
+ $s = '';
+ foreach($params as $k => $v){
+ $s = $k . '=' . $v;
+ }
+ throw new Exception('incorrect access token parameters returned: ' . implode('&', $s));
+ }
+ }
+
+} \ No newline at end of file