本文整理汇总了PHP中OAuth::provider方法的典型用法代码示例。如果您正苦于以下问题:PHP OAuth::provider方法的具体用法?PHP OAuth::provider怎么用?PHP OAuth::provider使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OAuth
的用法示例。
在下文中一共展示了OAuth::provider方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _remap
public function _remap($method, $args)
{
if ($method == 'linked') {
$this->linked();
return;
}
// Invalid method or no provider = BOOM
if (!in_array($method, array('session', 'callback')) or empty($args)) {
show_404();
}
// Get the provider (facebook, twitter, etc)
list($provider) = $args;
// This provider is not supported by the module
if (!isset($this->providers[$provider])) {
show_404();
}
// Look to see if we have this provider in the db?
if (!($credentials = $this->credential_m->get_active_provider($provider))) {
$this->ion_auth->is_admin() ? show_error('Social Integration: ' . $provider . ' is not supported, or not enabled.') : show_404();
}
// oauth or oauth 2?
$strategy = $this->providers[$provider];
switch ($strategy) {
case 'oauth':
include $this->module_details['path'] . '/oauth/libraries/OAuth.php';
$oauth = new OAuth();
// Create an consumer from the config
$consumer = $oauth->consumer(array('key' => $credentials->client_key, 'secret' => $credentials->client_secret));
// Load the provider
$provider = $oauth->provider($provider);
break;
case 'oauth2':
include $this->module_details['path'] . '/oauth2/libraries/OAuth2.php';
$oauth2 = new OAuth2();
// OAuth2 is the honey badger when it comes to consumers - it just dont give a shit
$consumer = null;
$provider = $oauth2->provider($provider, array('id' => $credentials->client_key, 'secret' => $credentials->client_secret, 'scope' => $credentials->scope));
break;
default:
exit('Something went properly wrong!');
}
// Call session or callback, with lots of handy details
call_user_func(array($this, '_' . $method), $strategy, $provider, $consumer);
}