ddd
Showing
1 changed file
with
3 additions
and
8 deletions
| ... | @@ -215,13 +215,7 @@ public function isGoogleFolderCreated($cust_id) | ... | @@ -215,13 +215,7 @@ public function isGoogleFolderCreated($cust_id) |
| 215 | 215 | ||
| 216 | $client->setApprovalPrompt('force'); | 216 | $client->setApprovalPrompt('force'); |
| 217 | 217 | ||
| 218 | if (isset($_GET['code'])) { | 218 | |
| 219 | $client->authenticate($_GET['code']); | ||
| 220 | $_SESSION['token'] = $client->getAccessToken(); | ||
| 221 | $redirect = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']; | ||
| 222 | header('Location: ' . filter_var($redirect, FILTER_SANITIZE_URL)); | ||
| 223 | return; | ||
| 224 | } | ||
| 225 | 219 | ||
| 226 | if (isset($_SESSION['token'])) { | 220 | if (isset($_SESSION['token'])) { |
| 227 | $client->setAccessToken($_SESSION['token']); | 221 | $client->setAccessToken($_SESSION['token']); |
| ... | @@ -240,7 +234,8 @@ public function isGoogleFolderCreated($cust_id) | ... | @@ -240,7 +234,8 @@ public function isGoogleFolderCreated($cust_id) |
| 240 | <body> | 234 | <body> |
| 241 | <header><h1>Get Token</h1></header> | 235 | <header><h1>Get Token</h1></header> |
| 242 | <?php | 236 | <?php |
| 243 | if ($client->getAccessToken()) { | 237 | if (isset($_GET['code'])) { |
| 238 | $client->authenticate($_GET['code']); | ||
| 244 | $_SESSION['token'] = $client->getAccessToken(); | 239 | $_SESSION['token'] = $client->getAccessToken(); |
| 245 | $token = json_decode($_SESSION['token']); | 240 | $token = json_decode($_SESSION['token']); |
| 246 | echo "Access Token = " . $token->access_token . '<br/>'; | 241 | echo "Access Token = " . $token->access_token . '<br/>'; | ... | ... |
-
Please register or sign in to post a comment