/**
  * \brief Tokenエンドポイントリソース取得メソッド
  */
 public function fetchToken()
 {
     parent::setParam("grant_type", GrantType::REFRESH_TOKEN);
     parent::setParam("refresh_token", $this->refresh_token);
     parent::fetchToken();
     $res_body = parent::getResponse();
     // JSONパラメータ抽出処理
     $json_response = json_decode($res_body, true);
     Logger::debug("json response(" . get_class() . "::" . __FUNCTION__ . ")", $json_response);
     if ($json_response != null) {
         if (empty($json_response["error"])) {
             $access_token = $json_response["access_token"];
             $exp = $json_response["expires_in"];
             $this->access_token = new BearerToken($access_token, $exp);
         } else {
             $error = $json_response["error"];
             $error_desc = $json_response["error_description"];
             Logger::error($error . "(" . get_class() . "::" . __FUNCTION__ . ")", $error_desc);
             throw new TokenException($error, $error_desc);
         }
     } else {
         Logger::error("no_response(" . get_class() . "::" . __FUNCTION__ . ")", "Failed to get the response body");
         throw new TokenException("no_response", "Failed to get the response body");
     }
     Logger::debug("refresh token response(" . get_class() . "::" . __FUNCTION__ . ")", array($this->access_token));
     Logger::info("got access and refresh token(" . get_class() . "::" . __FUNCTION__ . ")");
 }
 /**
  * \brief ClientCredentialsClientのインスタンス生成
  */
 public function __construct($endpoint_url, $client_credential, $scopes)
 {
     parent::__construct($endpoint_url, $client_credential);
     $this->scopes = $scopes;
 }
 /**
  * \brief Tokenエンドポイントリソース取得メソッド
  */
 public function fetchToken()
 {
     parent::setParam("grant_type", GrantType::AUTHORIZATION_CODE);
     parent::setParam("code", $this->code);
     parent::setParam("redirect_uri", $this->redirect_uri);
     parent::fetchToken();
     $res_body = parent::getResponse();
     // JSONパラメータ抽出処理
     $json_response = json_decode($res_body, true);
     Logger::debug("json response(" . get_class() . "::" . __FUNCTION__ . ")", $json_response);
     if ($json_response != null) {
         if (empty($json_response["error"])) {
             $access_token = $json_response["access_token"];
             $exp = $json_response["expires_in"];
             $refresh_token = $json_response["refresh_token"];
             $this->access_token = new BearerToken($access_token, $exp);
             $this->refresh_token = new RefreshToken($refresh_token);
             if (array_key_exists("id_token", $json_response)) {
                 $id_token = $json_response["id_token"];
                 $id_token_object = new IdToken($id_token, $this->cred->secret);
                 $this->id_token = $id_token_object->getIdToken();
             }
         } else {
             $error = $json_response["error"];
             $error_desc = $json_response["error_description"];
             Logger::error($error . "(" . get_class() . "::" . __FUNCTION__ . ")", $error_desc);
             throw new TokenException($error, $error_desc);
         }
     } else {
         Logger::error("no_response(" . get_class() . "::" . __FUNCTION__ . ")", "Failed to get the response body");
         throw new TokenException("no_response", "Failed to get the response body");
     }
     Logger::debug("token endpoint response(" . get_class() . "::" . __FUNCTION__ . ")", array($this->access_token, $this->refresh_token));
     Logger::info("got access and refresh token(" . get_class() . "::" . __FUNCTION__ . ")");
 }