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


PHP FacebookSession::_getTargetAppId方法代码示例

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


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

示例1: getAccessToken

 /**
  * @param $code
  * @return null
  * @throws \Facebook\FacebookRequestException
  * @throws \Facebook\FacebookSDKException
  */
 protected function getAccessToken($code)
 {
     $response = (new FacebookRequest(FacebookSession::newAppSession(), 'GET', '/oauth/access_token', ['client_id' => FacebookSession::_getTargetAppId(), 'client_secret' => FacebookSession::_getTargetAppSecret(), 'redirect_uri' => Config::get('auth.providers.facebook.redirect_uri'), 'code' => $code]))->execute()->getResponse();
     // Graph v2.3 and greater return objects on the /oauth/access_token endpoint
     $accessToken = null;
     if (is_object($response) && isset($response->access_token)) {
         $accessToken = $response->access_token;
     } elseif (is_array($response) && isset($response['access_token'])) {
         $accessToken = $response['access_token'];
     }
     return $accessToken;
 }
开发者ID:bashmach,项目名称:ggf,代码行数:18,代码来源:Guard.php

示例2: __construct

 /**
  * Initialize the helper and process available signed request data.
  *
  * @param string|null $appId
  * @param string|null $appSecret
  */
 public function __construct($appId = null, $appSecret = null)
 {
     $this->appId = FacebookSession::_getTargetAppId($appId);
     $this->appSecret = FacebookSession::_getTargetAppSecret($appSecret);
     $this->instantiateSignedRequest();
 }
开发者ID:sodacrackers,项目名称:washyacht,代码行数:12,代码来源:FacebookSignedRequestFromInputHelper.php

示例3: request

 /**
  * Send a request to Graph with an app access token.
  *
  * @param string $endpoint
  * @param array $params
  * @param string|null $appId
  * @param string|null $appSecret
  *
  * @return \Facebook\FacebookResponse
  *
  * @throws FacebookRequestException
  */
 protected static function request($endpoint, array $params, $appId = null, $appSecret = null)
 {
     $targetAppId = FacebookSession::_getTargetAppId($appId);
     $targetAppSecret = FacebookSession::_getTargetAppSecret($appSecret);
     if (!isset($params['client_id'])) {
         $params['client_id'] = $targetAppId;
     }
     if (!isset($params['client_secret'])) {
         $params['client_secret'] = $targetAppSecret;
     }
     // The response for this endpoint is not JSON, so it must be handled
     //   differently, not as a GraphObject.
     $request = new FacebookRequest(FacebookSession::newAppSession($targetAppId, $targetAppSecret), 'GET', $endpoint, $params);
     return $request->execute();
 }
开发者ID:rolencea,项目名称:com.civicrm.civisocial,代码行数:27,代码来源:AccessToken.php

示例4: createTestUser

 /**
  * @param $name
  * @param array $permissions
  *
  * @return array
  */
 public function createTestUser($name, array $permissions)
 {
     $response = $this->executeFacebookRequest($this->appSession, 'POST', '/' . FacebookSession::_getTargetAppId() . '/accounts/test-users', ['name' => $name, 'installed' => true, 'permissions' => $permissions])->getRawResponse();
     return json_decode($response, true);
 }
开发者ID:namnv609,项目名称:Codeception,代码行数:11,代码来源:Facebook.php

示例5: __construct

 /**
  * Constructs a RedirectLoginHelper for a given appId.
  *
  * @param string $appId The application id
  * @param string $appSecret The application secret
  */
 public function __construct($appId = null, $appSecret = null)
 {
     $this->appId = FacebookSession::_getTargetAppId($appId);
     $this->appSecret = FacebookSession::_getTargetAppSecret($appSecret);
 }
开发者ID:andreasspak,项目名称:social-networks-api,代码行数:11,代码来源:FacebookRedirectLoginHelper.php

示例6: fbAuthAction

 public function fbAuthAction()
 {
     $this->view->disable();
     $params = array('client_id' => FacebookSession::_getTargetAppId($this->config->facebook->appId), 'redirect_uri' => $this->config->facebook->redirect, 'client_secret' => FacebookSession::_getTargetAppSecret($this->config->facebook->secret), 'code' => isset($_GET['code']) ? $_GET['code'] : null);
     $response = (new FacebookRequest(FacebookSession::newAppSession($this->config->facebook->appId, $this->config->facebook->secret), 'GET', '/oauth/access_token', $params))->execute()->getResponse();
     if (isset($response['access_token'])) {
         $session = new FacebookSession($response['access_token']);
     }
     if (isset($session)) {
         $userSession['access_token'] = $response['access_token'];
         $request = new FacebookRequest($session, 'GET', '/me');
         $response = $request->execute();
         // get response
         $graphObject = $response->getGraphObject();
         $email = $graphObject->getProperty('email');
         $fbId = $graphObject->getProperty('id');
         $verified = $graphObject->getProperty('verified');
         $firstName = $graphObject->getProperty('first_name');
         $lastName = $graphObject->getProperty('last_name');
         $fullName = $graphObject->getProperty('name');
         $gender = $graphObject->getProperty('gender');
         $profileLink = $graphObject->getProperty('link');
         $bday = $graphObject->getProperty('birthday');
         $email = $graphObject->getProperty('email');
         $city = $graphObject->getProperty('location')->getProperty('name');
         if (!isset($email)) {
             $email = $fbId . '@facebook.com';
         }
         if (isset($bday)) {
             $bday = date('Y-m-d', strtotime($bday));
         }
         $socialData = array('social_network' => 'Facebook', 'social_id' => $fbId, 'first_name' => $firstName, 'last_name' => $lastName, 'full_name' => $fullName, 'gender' => $gender, 'profile_link' => $profileLink, 'birthday' => $bday, 'email' => $email, 'city' => $city, 'access_token' => $userSession['access_token']);
         if ($member = Members::findFirstByEmail($email)) {
             $userSession = get_object_vars($member);
             if (!($socialProfile = SocialProfiles::findFirstByEmail($email))) {
                 $socialData['member_id'] = $member->id;
                 $this->newSocialProfile($socialData);
             }
         } else {
             $memberId = $this->newMember($socialData);
             $socialData['id'] = $memberId;
             $userSession = $socialData;
             $socialData['member_id'] = $memberId;
             $this->newSocialProfile($socialData);
         }
         //print_r($graphObject);
         $this->session->set('userSession', $userSession);
     }
     return $this->response->redirect();
 }
开发者ID:hinjanobara,项目名称:mbimages,代码行数:50,代码来源:MemberController.php


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