setAuthConfig('/var/www/secure/oauth-client.json'); $client->setRedirectUri('https://llm.modulos.com.au/oauth_callback.php'); $client->setScopes([ Google\Service\Drive::DRIVE, Google\Service\Docs::DOCUMENTS ]); if (!isset($_GET['code'])) { http_response_code(400); echo 'Missing ?code'; exit; } $token = $client->fetchAccessTokenWithAuthCode($_GET['code']); if (isset($token['error'])) { http_response_code(500); echo 'OAuth error: ' . htmlspecialchars(json_encode($token)); exit; } file_put_contents(__DIR__ . '/cache/gdocs_token.json', json_encode($token, JSON_PRETTY_PRINT)); echo '

Connected ✅

You can close this tab and try “Create Google Doc” again.

';