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


PHP oauth_client_class::ResetAccessToken方法代码示例

本文整理汇总了PHP中oauth_client_class::ResetAccessToken方法的典型用法代码示例。如果您正苦于以下问题:PHP oauth_client_class::ResetAccessToken方法的具体用法?PHP oauth_client_class::ResetAccessToken怎么用?PHP oauth_client_class::ResetAccessToken使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在oauth_client_class的用法示例。


在下文中一共展示了oauth_client_class::ResetAccessToken方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: array

     if (strlen($client->access_token)) {
         $success = $client->CallAPI('https://graph.facebook.com/me', 'GET', array(), array('FailOnAccessError' => true), $user);
     }
 }
 // LinkedIn
 if ($OAuth_servicio == 'LinkedIn') {
     if (strlen($client->access_token)) {
         $success = $client->CallAPI('http://api.linkedin.com/v1/people/~', 'GET', array('format' => 'json'), array('FailOnAccessError' => true), $user);
     }
 }
 // Instagram
 if ($OAuth_servicio == 'Instagram') {
     if (strlen($client->access_token)) {
         $success = $client->CallAPI('https://api.instagram.com/v1/users/self/', 'GET', array(), array('FailOnAccessError' => true), $user);
         if (!$success) {
             $client->ResetAccessToken();
         }
     }
 }
 // Dropbox
 if ($OAuth_servicio == 'Dropbox') {
     if (strlen($client->access_token)) {
         $success = $client->CallAPI('https://api.dropbox.com/1/account/info', 'GET', array(), array('FailOnAccessError' => true), $user);
     }
 }
 // Microsoft
 if ($OAuth_servicio == 'Microsoft') {
     if (strlen($client->authorization_error)) {
         $client->error = $client->authorization_error;
         $success = false;
     } elseif (strlen($client->access_token)) {
开发者ID:afgstec,项目名称:practico,代码行数:31,代码来源:ws_funciones.php

示例2: Dropbox

 public static function Dropbox($oTenant)
 {
     $bResult = false;
     $oUser = null;
     $bDropboxAllow = $oTenant->SocialDropboxAllow;
     $sDropboxId = $oTenant->SocialDropboxKey;
     $sDropboxSecret = $oTenant->SocialDropboxSecret;
     $sRedirectUrl = rtrim(\MailSo\Base\Http::SingletonInstance()->GetFullUrl(), '\\/ ') . '/?dropbox';
     if (!strpos($sRedirectUrl, '://localhost')) {
         $sRedirectUrl = str_replace('http:', 'https:', $sRedirectUrl);
     }
     if ($bDropboxAllow) {
         require PSEVEN_APP_ROOT_PATH . 'libraries/OAuthClient/http.php';
         require PSEVEN_APP_ROOT_PATH . 'libraries/OAuthClient/oauth_client.php';
         $oClient = new \oauth_client_class();
         $oClient->debug = self::$Debug;
         $oClient->debug_http = self::$Debug;
         $oClient->server = 'Dropbox2';
         $oClient->redirect_uri = $sRedirectUrl;
         $oClient->client_id = $sDropboxId;
         $application_line = __LINE__;
         $oClient->client_secret = $sDropboxSecret;
         $oClient->configuration_file = PSEVEN_APP_ROOT_PATH . 'libraries/OAuthClient/' . $oClient->configuration_file;
         if (strlen($oClient->client_id) == 0 || strlen($oClient->client_secret) == 0) {
             $bResult = false;
             exit('Please go to Dropbox Apps page https://www.dropbox.com/developers/apps , ' . 'create an application, and in the line ' . $application_line . ' set the client_id to Consumer key and client_secret with Consumer secret. ' . 'The Callback URL must be ' . $oClient->redirect_uri) . ' Make sure this URL is ' . 'not in a private network and accessible to the Dropbox site.';
         }
         if ($success = $oClient->Initialize()) {
             if ($success = $oClient->Process()) {
                 if (strlen($oClient->access_token)) {
                     $success = $oClient->CallAPI('https://api.dropbox.com/1/account/info', 'GET', array(), array('FailOnAccessError' => true), $oUser);
                 }
             }
             $success = $oClient->Finalize($success);
         }
         if ($oClient->exit) {
             $bResult = false;
             exit;
         }
         if ($success && $oUser) {
             // if you need re-ask user for permission
             //$oClient->ResetAccessToken();
             $aSocial = array('type' => 'dropbox', 'id' => $oUser->uid, 'name' => $oUser->display_name, 'email' => isset($oUser->email) ? $oUser->email : '', 'access_token' => $oClient->access_token);
             \CApi::Log('social_user_dropbox');
             \CApi::LogObject($oUser);
             $bResult = $aSocial;
         } else {
             $bResult = false;
             $oClient->ResetAccessToken();
             self::_socialError($oClient->error, 'dropbox');
         }
     }
     return $bResult;
 }
开发者ID:hallnewman,项目名称:webmail-lite,代码行数:54,代码来源:social.php

示例3: service_social_login_naver

 public static function service_social_login_naver()
 {
     if (isset($_GET['sym-api']) && $_GET['sym-api'] == 'service-social-login-naver') {
         update_option(WSKL_PREFIX . 'sym-api-' . $_SERVER['HTTP_CLIENT_IP'], 'service-social-login-naver');
     }
     if (isset($_GET['sym-api']) && $_GET['sym-api'] == 'service-social-login-naver' || isset($_GET['code']) && get_option(WSKL_PREFIX . 'sym-api-' . $_SERVER['HTTP_CLIENT_IP']) == 'service-social-login-naver') {
         require 'home-social-login/http.php';
         require 'home-social-login/oauth_client.php';
         $client = new oauth_client_class();
         $client->debug = FALSE;
         $client->debug_http = TRUE;
         $client->server = 'Naver';
         $client->redirect_uri = site_url() . '/index.php';
         $client->client_id = get_option(wskl_get_option_name('naver_client_id'));
         $client->client_secret = get_option(wskl_get_option_name('naver_client_secret'));
         if (strlen($client->client_id) == 0 || strlen($client->client_secret) == 0) {
             wskl_sym__alert('네이버 연동키값을 확인해 주세요.');
         }
         if ($login == 'Y') {
             unset($_SESSION['OAUTH_STATE']);
             $client->ResetAccessToken();
         }
         /* API permissions
          */
         if ($success = $client->Initialize()) {
             if ($success = $client->Process()) {
                 if (strlen($client->access_token)) {
                     $success = $client->CallAPI('https://apis.naver.com/nidlogin/nid/getUserProfile.xml', 'POST', array('mode' => 'userinfo'), array('FailOnAccessError' => TRUE), $user);
                 }
             }
             $success = $client->Finalize($success);
         }
         if ($client->exit) {
             exit;
         }
         if ($success) {
             $xml = simplexml_load_string($user);
             if ($xml->result->resultcode == '00') {
                 $client->GetAccessToken($AccessToken);
                 $mb_gubun = 'naver';
                 $mb_id = $xml->response->enc_id;
                 $mb_name = $xml->response->nickname;
                 $mb_nick = $xml->response->nickname;
                 $mb_email = $xml->response->email;
                 $token_value = $AccessToken['value'];
                 $token_refresh = $AccessToken['refresh'];
                 $token_secret = '';
                 //$client->ResetAccessToken();
                 if (!trim($mb_id) || !trim($token_value)) {
                     wskl_sym__alert("정보가 제대로 넘어오지 않아 오류가 발생했습니다.");
                 }
                 $token_array = urlencode(static::encryptIt($mb_gubun . '|' . substr(str_replace('|', '', $mb_id), 0, 18) . '|' . $mb_name . '|' . $mb_nick . '|' . $mb_email));
                 $redirect_url = '/?sym-api=process-social-login&token=' . $token_array;
                 wp_redirect($redirect_url);
                 exit;
             } else {
                 $error = htmlspecialchars($xml->result->resultcode);
                 alert_close($error);
             }
         } else {
             $error = htmlspecialchars($client->error);
             alert_close($error);
         }
     }
 }
开发者ID:EricKim65,项目名称:woosym-korean-localization,代码行数:65,代码来源:class-social-login.php


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