@@ 241-257 (lines=17) @@ | ||
238 | * |
|
239 | * @return string |
|
240 | */ |
|
241 | public function getTokenFromServer() |
|
242 | { |
|
243 | $params = [ |
|
244 | 'corpid' => $this->id, |
|
245 | 'corpsecret' => $this->secret, |
|
246 | ]; |
|
247 | ||
248 | $http = $this->getHttp(); |
|
249 | ||
250 | $token = $http->parseJSON($http->get(self::API_TOKEN_GET, $params)); |
|
251 | ||
252 | if (empty($token[$this->tokenJsonKey])) { |
|
253 | throw new HttpException('Request AccessToken fail. response: '.json_encode($token, JSON_UNESCAPED_UNICODE)); |
|
254 | } |
|
255 | ||
256 | return $token; |
|
257 | } |
|
258 | ||
259 | /** |
|
260 | * Return the http instance. |
@@ 52-69 (lines=18) @@ | ||
49 | /** |
|
50 | * {@inheritdoc}. |
|
51 | */ |
|
52 | public function getTokenFromServer() |
|
53 | { |
|
54 | $data = [ |
|
55 | 'suite_id' => $this->id, |
|
56 | 'suite_secret' => $this->secret, |
|
57 | 'suite_ticket' => $this->ticket->getTicket(), |
|
58 | ]; |
|
59 | ||
60 | $http = $this->getHttp(); |
|
61 | ||
62 | $token = $http->parseJSON($http->json(self::API_TOKEN_GET, $data)); |
|
63 | ||
64 | if (empty($token[$this->tokenJsonKey])) { |
|
65 | throw new HttpException('Request SuiteAccessToken fail. response: '.json_encode($token, JSON_UNESCAPED_UNICODE)); |
|
66 | } |
|
67 | ||
68 | return $token; |
|
69 | } |
|
70 | } |
|
71 |