This is my first post here, please excuse me if I’m missing something.
I’m using PHP with google/apiclient v2.14.0
to create new spreadsheets via the Google Sheets API using:
POST https://sheets.googleapis.com/v4/spreadsheets
Problem
The functionality worked perfectly for about a month, but starting about a week ago, it began returning the following error:
[error] => Array
(
[code] => 403
[message] => The caller does not have permission
[errors] => Array
(
[0] => Array
(
[message] => The caller does not have permission
[domain] => global
[reason] => forbidden
)
)
[status] => PERMISSION_DENIED
)
What’s Strange
The most puzzling aspect is that no changes were made to GCP or PHP configurations, yet this error suddenly appeared.
What I’ve Tried
I attempted the following solutions, but none resolved the issue:
- Regenerated the service account private key associated with the GCP service account
- Created a completely new service account and generated a new private key
- Changed the root Google account entirely
Additional Testing and Verification
I have also confirmed the following to rule out common issues:
- Read operations work perfectly - GET requests to retrieve data from specific sheets work without any problems
- APIs are properly enabled - I have double-checked that both Google Sheets API and Google Drive API are enabled in the Google Cloud Console
My Theory and Confusion
I initially suspected that my Google account was somehow being blocked (403), so I switched to a different Google account. However, the 403 error persisted even with the new account.
This is extremely puzzling. Could it be that GCP is implementing some kind of control per IP address rather than per Google account?
Request for Help
I would appreciate any insights, no matter how small, regarding the root cause and potential solutions for this issue.
Thank you in advance for your assistance.