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


PHP BaseFacebook::getUser方法代码示例

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


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

示例1: authenticate

 public function authenticate(TokenInterface $token)
 {
     if (!$this->supports($token)) {
         return null;
     }
     $user = $token->getUser();
     if ($user instanceof UserInterface) {
         $this->userChecker->checkPostAuth($user);
         $newToken = new FacebookUserToken($this->providerKey, $user, $user->getRoles());
         $newToken->setAttributes($token->getAttributes());
         return $newToken;
     }
     try {
         if ($uid = $this->facebook->getUser()) {
             $newToken = $this->createAuthenticatedToken($uid);
             $newToken->setAttributes($token->getAttributes());
             return $newToken;
         }
     } catch (AuthenticationException $failed) {
         throw $failed;
     } catch (\Exception $failed) {
         throw new AuthenticationException($failed->getMessage(), null, (int) $failed->getCode(), $failed);
     }
     throw new AuthenticationException('The Facebook user could not be retrieved from the session.');
 }
开发者ID:hykz,项目名称:Depot,代码行数:25,代码来源:FacebookProvider.php

示例2: authenticate

 public function authenticate(TokenInterface $token)
 {
     if (!$this->supports($token)) {
         return null;
     }
     try {
         if ($uid = $this->facebook->getUser()) {
             $token->setUser($uid);
             return $this->createAuthenticatedToken($uid);
         }
     } catch (AuthenticationException $failed) {
         throw $failed;
     } catch (\Exception $failed) {
         throw new AuthenticationException('Unknown error', $failed->getMessage(), $failed->getCode(), $failed);
     }
     throw new AuthenticationException('The Facebook user could not be retrieved from the session.');
 }
开发者ID:herdani,项目名称:FOSFacebookBundle,代码行数:17,代码来源:FacebookProvider.php

示例3: authenticate

 public function authenticate(TokenInterface $token)
 {
     if (!$this->supports($token)) {
         return null;
     }
     $user = $token->getUser();
     if ($user instanceof UserInterface) {
         $this->userChecker->checkPostAuth($user);
         $newToken = new FacebookUserToken($this->providerKey, $user, $user->getRoles(), $token->getAccessToken());
         $newToken->setAttributes($token->getAttributes());
         return $newToken;
     }
     if (!is_null($token->getAccessToken())) {
         $this->facebook->setAccessToken($token->getAccessToken());
     }
     if ($uid = $this->facebook->getUser()) {
         $newToken = $this->createAuthenticatedToken($uid, $token->getAccessToken());
         $newToken->setAttributes($token->getAttributes());
         return $newToken;
     }
     throw new AuthenticationException('The Facebook user could not be retrieved from the session.');
 }
开发者ID:hientranquang,项目名称:FOSFacebookBundle,代码行数:22,代码来源:FacebookProvider.php


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