当前位置: 首页>>代码示例>>PHP>>正文


PHP OAuth::provider方法代码示例

本文整理汇总了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);
 }
开发者ID:relinkus,项目名称:ManageFan,代码行数:44,代码来源:social.php


注:本文中的OAuth::provider方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。