Automation init...3

This commit is contained in:
최준흠 2024-09-13 10:58:37 +09:00
parent fa6bbf0814
commit 6f42de5eb2
2 changed files with 7 additions and 6 deletions

View File

@ -18,9 +18,9 @@ class GoogleLibrary extends WebLibrary
if (is_null($this->_client)) { if (is_null($this->_client)) {
// $this->_client = new \Google_Client(); // $this->_client = new \Google_Client();
$this->_client = new \GuzzleHttp\Client(); $this->_client = new \GuzzleHttp\Client();
$this->_client->setClientId(getenv("google.client.id")); $this->_client->setClientId(getenv("socket.google.client.id"));
$this->_client->setClientSecret(getenv("google.client.key")); $this->_client->setClientSecret(getenv("socket.google.client.key"));
$this->_client->setRedirectUri(base_url() . getenv("google.client.callback_url")); $this->_client->setRedirectUri(base_url() . getenv("socket.google.client.callback_url"));
$this->_client->addScope('email'); $this->_client->addScope('email');
$this->_client->addScope('profile'); $this->_client->addScope('profile');
} }
@ -46,14 +46,14 @@ class GoogleLibrary extends WebLibrary
if (isset($tokenInfo['error'])) { if (isset($tokenInfo['error'])) {
throw new \Exception($tokenInfo['error']); throw new \Exception($tokenInfo['error']);
} }
$token = $tokenInfo[getenv("google.client.token_name")]; $token = $tokenInfo[getenv("socket.google.client.token_name")];
//3. Google Service에 접근하기위해 Access Token을 설정 //3. Google Service에 접근하기위해 Access Token을 설정
$this->getClient()->setAccessToken($token); $this->getClient()->setAccessToken($token);
//4. Google에 로그인이 했으므로 세션에 Token값 설정 //4. Google에 로그인이 했으므로 세션에 Token값 설정
$this->_session->set(getenv("google.client.token_name"), $token); $this->_session->set(getenv("socket.google.client.token_name"), $token);
} }
public function getAccessToken(): ?string public function getAccessToken(): ?string
{ {
return $this->_session->get(getenv("google.client.token_name")); return $this->_session->get(getenv("socket.google.client.token_name"));
} }
} }

View File

@ -46,6 +46,7 @@ class WebLibrary extends MySocketLibrary
//기본 //기본
$options = [ $options = [
'cookies' => $this->getCookieJar(), 'cookies' => $this->getCookieJar(),
'timeout' => getenv("socket.web.timeout"), // 5초 안에 응답이 없으면 타임아웃
]; ];
switch ($type) { switch ($type) {
case 'agent': case 'agent':