Пример #1
0
 /**
  * @param Request $request
  * @param string|null $redirectUri
  * @throws \Symfony\Component\Security\Core\Exception\AuthenticationException
  * @throws AppscoOAuthException
  * @return AppscoToken
  */
 public function callback(Request $request, $redirectUri = null)
 {
     $code = $request->get('code');
     $state = $request->get('state');
     $this->validateState($state);
     $this->checkError($request);
     $accessData = $this->client->getAccessData($code, $redirectUri);
     $profile = $this->client->profileRead('me');
     if (false == $profile) {
         throw new AuthenticationException('Unable to get profile info from Appsco');
     }
     return $this->createToken($accessData, $profile);
 }