diff --git a/src/providers/FacebookProvider.php b/src/providers/FacebookProvider.php index 135f732..ff27057 100644 --- a/src/providers/FacebookProvider.php +++ b/src/providers/FacebookProvider.php @@ -123,8 +123,9 @@ public function getCode() */ public function makeRedirect(string $url) { - if (!headers_sent()) { - app()->response->redirect($url); - } + if (!headers_sent()) + app() + ->response + ->redirect($url); } } diff --git a/src/providers/GoogleProvider.php b/src/providers/GoogleProvider.php index e2ddf65..51bf68e 100644 --- a/src/providers/GoogleProvider.php +++ b/src/providers/GoogleProvider.php @@ -75,6 +75,7 @@ public function redirect() public function user() { $code = $this->getCode(); + if (!empty($code)) { try { $params = $this->getParams($code); @@ -82,7 +83,6 @@ public function user() $curl = new Curl(); $response = $curl->post(self::ACCESS_TOKEN_URL, $params); $data = json_decode($response['response'], true); - $userInfoUrl = self::USER_INFO_URL . '?access_token=' . $data['access_token']; $userInfoResponse = $curl->get($userInfoUrl); $userInfo = json_decode($userInfoResponse['response'], true);