コード例 #1
0
 /**
  * @param Request $request
  * @return Response
  */
 public function callbackAction(Request $request)
 {
     $requestToken = $request->getSession()->get(self::SESSION_REQUEST_TOKEN);
     $request->getSession()->remove(self::SESSION_REQUEST_TOKEN);
     $oauth_token = $request->get('oauth_token');
     $oauth_verifier = $request->get('oauth_verifier');
     $this->validateCallbackTokens($requestToken, $oauth_token, $oauth_verifier);
     $accessToken = $this->twitter->getAccessToken($requestToken, $oauth_verifier);
     $request->getSession()->set(self::SESSION_ACCESS_TOKEN, $accessToken);
     $response = new RedirectResponse($request->getSession()->get(self::SESSION_FORWARD_URI));
     $request->getSession()->remove(self::SESSION_FORWARD_URI);
     return $response;
 }