PHP Fatal error: Uncaught Google\Service\Exception: { "error": "unauthorized_client", "error_description": "Unauthorized" }

PHP Fatal error: Uncaught Google\Service\Exception: { "error": "unauthorized_client", "error_description": "Unauthorized" }

我遵循了https://developers.google.com/sheets/api/quickstart/php

中提到的所有步骤

但我收到以下错误:-

PHP Fatal error: Uncaught Google\Service\Exception: { "error": "unauthorized_client", "error_description": "Unauthorized" } in /usr/local/var/www/web/vendor/google/apiclient/src/Http/REST.php:128

除此之外,请确保您已选择 Web 浏览器并正确设置来源 url。对于 PHP,我建议使用网络浏览器选项。

或者您可能必须再次生成客户端 ID 和机密 ID,然后尝试。