示例#1
0
 function __construct()
 {
     parent::__construct();
     $this->place_types = array('unknown' => __('Unknown', 'keyring'), 'home' => __('Home', 'keyring'), 'work' => __('Work', 'keyring'), 'school' => __('School', 'keyring'), 'user' => __('Manually Named', 'keyring'), 'foursquare' => __('Selected from foursquare', 'keyring'));
     $this->activity_types = array('wlk' => __('Walking', 'keyring'), 'cyc' => __('Cycling', 'keyring'), 'run' => __('Running', 'keyring'), 'trp' => __('Transport', 'keyring'));
     // Enable "basic" UI for entering key/secret
     if (!KEYRING__HEADLESS_MODE) {
         add_action('keyring_moves_manage_ui', array($this, 'basic_ui'));
         add_filter('keyring_moves_basic_ui_intro', array($this, 'basic_ui_intro'));
     }
     $this->set_endpoint('authorize', 'https://api.moves-app.com/oauth/v1/authorize', 'GET');
     $this->set_endpoint('access_token', 'https://api.moves-app.com/oauth/v1/access_token', 'POST');
     $this->set_endpoint('verify_token', 'https://api.moves-app.com/oauth/v1/tokeninfo', 'GET');
     $this->set_endpoint('profile', 'https://api.moves-app.com/api/1.1/user/profile', 'GET');
     $creds = $this->get_credentials();
     $this->app_id = $creds['app_id'];
     $this->key = $creds['key'];
     $this->secret = $creds['secret'];
     $this->consumer = new OAuthConsumer($this->key, $this->secret, $this->callback_url);
     $this->signature_method = new OAuthSignatureMethod_HMAC_SHA1();
     // Moves requires an exact match on Redirect URI, which means we can't send any nonces
     $this->callback_url = remove_query_arg(array('nonce', 'kr_nonce'), $this->callback_url);
     add_action('pre_keyring_moves_verify', array($this, 'redirect_incoming_verify'));
     $this->authorization_header = 'Bearer';
     $this->authorization_parameter = false;
     add_filter('keyring_moves_request_token_params', array($this, 'request_token_params'));
 }
示例#2
0
 function __construct()
 {
     parent::__construct();
     // Enable "basic" UI for entering key/secret
     if (!KEYRING__HEADLESS_MODE) {
         add_action('keyring_google-contacts_manage_ui', array($this, 'basic_ui'));
         add_filter('keyring_google-contacts_basic_ui_intro', array($this, 'basic_ui_intro'));
     }
     // Set scope
     add_filter('keyring_google-contacts_request_token_params', array($this, 'request_token_params'));
     // Handle Google's annoying limitation of not allowing us to redirect to a dynamic URL
     add_action('pre_keyring_google-contacts_verify', array($this, 'redirect_incoming_verify'));
     $this->set_endpoint('authorize', 'https://accounts.google.com/o/oauth2/auth', 'GET');
     $this->set_endpoint('access_token', 'https://accounts.google.com/o/oauth2/token', 'POST');
     $this->set_endpoint('self', 'https://www.googleapis.com/oauth2/v1/userinfo', 'GET');
     $creds = $this->get_credentials();
     $this->redirect_uri = $creds['redirect_uri'];
     $this->key = $creds['key'];
     $this->secret = $creds['secret'];
     $this->consumer = new OAuthConsumer($this->key, $this->secret, $this->callback_url);
     $this->signature_method = new OAuthSignatureMethod_HMAC_SHA1();
     $this->authorization_header = 'Bearer';
     // Oh, you
     $this->authorization_parameter = false;
     // Need to reset the callback because Google is very strict about where it sends people
     if (!empty($creds['redirect_uri'])) {
         $this->callback_url = $creds['redirect_uri'];
     } else {
         $this->callback_url = remove_query_arg(array('nonce', 'kr_nonce'), $this->callback_url);
     }
     // At least strip nonces, since you can't save them in your app config
 }
示例#3
0
 function __construct()
 {
     parent::__construct();
     // Enable "basic" UI for entering key/secret
     if (!KEYRING__HEADLESS_MODE) {
         add_action('keyring_fitbit_manage_ui', array($this, 'basic_ui'));
         add_filter('keyring_fitbit_basic_ui_intro', array($this, 'basic_ui_intro'));
     }
     $this->set_endpoint('authorize', 'https://www.fitbit.com/oauth2/authorize', 'GET');
     $this->set_endpoint('access_token', 'https://api.fitbit.com/oauth2/token', 'POST');
     $this->set_endpoint('refresh', 'https://api.fitbit.com/oauth2/token', 'POST');
     $this->set_endpoint('profile', 'https://api.fitbit.com/1/user/-/profile.json', 'GET');
     $creds = $this->get_credentials();
     $this->app_id = $creds['app_id'];
     $this->key = $creds['key'];
     $this->secret = $creds['secret'];
     $this->consumer = new OAuthConsumer($this->key, $this->secret, $this->callback_url);
     $this->signature_method = new OAuthSignatureMethod_HMAC_SHA1();
     // Fitbit requires an exact match on Redirect URI, which means we can't send any nonces
     $this->callback_url = remove_query_arg(array('nonce', 'kr_nonce'), $this->callback_url);
     add_action('pre_keyring_fitbit_verify', array($this, 'redirect_incoming_verify'));
     // Send authorization via header
     $this->authorization_header = 'Bearer';
     add_filter('keyring_fitbit_request_token_params', array($this, 'request_token_params'));
     add_filter('keyring_fitbit_verify_token_params', array($this, 'verify_token_params'));
     add_filter('keyring_fitbit_verify_token_post_params', array($this, 'verify_token_post_params'));
     add_filter('keyring_access_token', array($this, 'fix_access_token_meta'), 10, 2);
 }
示例#4
0
 function __construct()
 {
     parent::__construct();
     // Enable "basic" UI for entering key/secret
     if (!KEYRING__HEADLESS_MODE) {
         add_action('keyring_foursquare_manage_ui', array($this, 'basic_ui'));
         add_filter('keyring_foursquare_basic_ui_intro', array($this, 'basic_ui_intro'));
     }
     $this->set_endpoint('authorize', 'https://foursquare.com/oauth2/authenticate', 'GET');
     $this->set_endpoint('access_token', 'https://foursquare.com/oauth2/access_token', 'GET');
     $this->set_endpoint('self', 'https://api.foursquare.com/v2/users/self', 'GET');
     $creds = $this->get_credentials();
     $this->app_id = $creds['app_id'];
     $this->key = $creds['key'];
     $this->secret = $creds['secret'];
     $this->consumer = new OAuthConsumer($this->key, $this->secret, $this->callback_url);
     $this->signature_method = new OAuthSignatureMethod_HMAC_SHA1();
 }
示例#5
0
 function __construct()
 {
     parent::__construct();
     // Enable "basic" UI for entering key/secret
     if (!KEYRING__HEADLESS_MODE) {
         add_action('keyring_eventbrite_manage_ui', array($this, 'basic_ui'));
         add_filter('keyring_eventbrite_basic_ui_intro', array($this, 'basic_ui_intro'));
     }
     $creds = $this->get_credentials();
     $this->key = $creds['key'];
     $this->secret = $creds['secret'];
     $this->consumer = new OAuthConsumer($this->key, $this->secret, $this->callback_url);
     $this->signature_method = new OAuthSignatureMethod_HMAC_SHA1();
     $this->authorization_header = 'Bearer';
     // Oh, you
     $this->authorization_parameter = false;
     $this->set_endpoint('authorize', self::OAUTH_BASE . 'authorize', 'GET');
     $this->set_endpoint('access_token', self::OAUTH_BASE . 'token', 'POST');
     $this->set_endpoint('self', self::API_BASE . 'users/me/', 'GET');
 }
 function __construct()
 {
     parent::__construct();
     // Enable "basic" UI for entering key/secret
     if (!KEYRING__HEADLESS_MODE) {
         add_action('keyring_spotify_manage_ui', array($this, 'basic_ui'));
         add_filter('keyring_spotify_basic_ui_intro', array($this, 'basic_ui_intro'));
         add_filter('keyring_spotify_basic_ui_app_id', '__return_empty_string');
     }
     $this->set_endpoint('authorize', 'https://accounts.spotify.com/authorize', 'GET');
     $this->set_endpoint('access_token', 'https://accounts.spotify.com/api/token', 'POST');
     $this->set_endpoint('self', 'https://api.spotify.com/v1/me', 'GET');
     $creds = $this->get_credentials();
     $this->key = $creds['key'];
     $this->secret = $creds['secret'];
     $this->consumer = new OAuthConsumer($this->key, $this->secret, $this->callback_url);
     $this->signature_method = new OAuthSignatureMethod_HMAC_SHA1();
     $this->authorization_header = 'Bearer';
     $this->authorization_parameter = false;
 }
示例#7
0
 function __construct()
 {
     parent::__construct();
     // Enable "basic" UI for entering key/secret
     if (!KEYRING__HEADLESS_MODE) {
         add_action('keyring_facebook_manage_ui', array($this, 'basic_ui'));
         add_filter('keyring_facebook_basic_ui_intro', array($this, 'basic_ui_intro'));
     }
     $this->set_endpoint('authorize', 'https://www.facebook.com/dialog/oauth', 'GET');
     $this->set_endpoint('access_token', 'https://graph.facebook.com/oauth/access_token', 'GET');
     $this->set_endpoint('self', 'https://graph.facebook.com/me', 'GET');
     $creds = $this->get_credentials();
     $this->app_id = $creds['app_id'];
     $this->key = $creds['key'];
     $this->secret = $creds['secret'];
     $kr_nonce = wp_create_nonce('keyring-verify');
     $nonce = wp_create_nonce('keyring-verify-facebook');
     $this->redirect_uri = Keyring_Util::admin_url(self::NAME, array('action' => 'verify', 'kr_nonce' => $kr_nonce, 'nonce' => $nonce));
     $this->requires_token(true);
     add_filter('keyring_facebook_request_token_params', array($this, 'filter_request_token'));
 }
示例#8
0
 function __construct()
 {
     parent::__construct();
     // Enable "basic" UI for entering key/secret
     if (!KEYRING__HEADLESS_MODE) {
         add_action('keyring_instagram_manage_ui', array($this, 'basic_ui'));
         add_filter('keyring_instagram_basic_ui_intro', array($this, 'basic_ui_intro'));
     }
     $this->set_endpoint('authorize', 'https://api.instagram.com/oauth/authorize/', 'GET');
     $this->set_endpoint('access_token', 'https://api.instagram.com/oauth/access_token', 'POST');
     $this->set_endpoint('self', 'https://api.instagram.com/v1/users/self', 'GET');
     $creds = $this->get_credentials();
     $this->app_id = $creds['app_id'];
     $this->key = $creds['key'];
     $this->secret = $creds['secret'];
     $this->consumer = new OAuthConsumer($this->key, $this->secret, $this->callback_url);
     $this->signature_method = new OAuthSignatureMethod_HMAC_SHA1();
     $this->authorization_header = false;
     // Send in querystring
     $this->authorization_parameter = 'access_token';
 }
示例#9
0
 function __construct()
 {
     parent::__construct();
     // Enable "basic" UI for entering key/secret
     if (!KEYRING__HEADLESS_MODE) {
         add_action('keyring_runkeeper_manage_ui', array($this, 'basic_ui'));
         add_filter('keyring_runkeeper_basic_ui_intro', array($this, 'basic_ui_intro'));
     }
     $this->set_endpoint('authorize', 'https://runkeeper.com/apps/authorize', 'GET');
     $this->set_endpoint('access_token', 'https://runkeeper.com/apps/token', 'POST');
     $this->set_endpoint('deauthorize', 'https://runkeeper.com/apps/de-authorize', 'POST');
     $this->set_endpoint('user', 'https://api.runkeeper.com/user', 'GET');
     $this->set_endpoint('profile', 'https://api.runkeeper.com/profile', 'GET');
     $creds = $this->get_credentials();
     $this->app_id = $creds['app_id'];
     $this->key = $creds['key'];
     $this->secret = $creds['secret'];
     $this->consumer = new OAuthConsumer($this->key, $this->secret, $this->callback_url);
     $this->signature_method = new OAuthSignatureMethod_HMAC_SHA1();
     $this->authorization_header = 'Bearer';
     $this->authorization_parameter = false;
 }