Search code examples
phpoauth-2.0google-sheets-api

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


I followed all the steps mentioned in https://developers.google.com/sheets/api/quickstart/php

but I'm getting following error:-

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


Solution

  • Other things aside, please make sure that you have chosen Web Browser and give the origin url is set correctly. For PHP, I suggest Web Browser option.

    Configure OAuth Client Img

    OR PERHAPS you have to generate the client Id and secret Id again and try.