I'm Sneha and I'd be happy to help you out with your question. Sorry for the you had to face.
In your Python script, you need to ensure that the application is using the application default credentials. To do this, use the google.auth library and load the credentials explicitly. Here's an example:
from google.auth import app_engine
# Load application default credentials
credentials = app_engine.Credentials()
# Use the credentials to authorize requests
# Example: Authorize a BigQuery client
from google.cloud import bigquery
client = bigquery.Client(credentials=credentials)
By loading the credentials explicitly, you ensure that the correct default service account and its associated permissions are used.
After making the necessary code changes and ensuring the correct credentials are used, redeploy your GAE application. The updated application should now have the necessary access to Google Drive and Sheets.
Please note that it may take a few minutes for the changes to propagate and the updated access controls to take effect.
For more Information, please refer to following resources :-
Setting up access control | Google App Engine standard environment docs - https://cloud.google.com/appengine/docs/standard/access-control
How Application Default Credentials works | Authentication - https://cloud.google.com/docs/authentication/application-default-credentials
I hope this information helps. If you have any questions, please let me know and be glad to assist you further.
Give back to the Community. Help the next person who has this issue by indicating if this reply solved your problem. Click Like or Dislike below.
Thanks & Regards
Sneha Gupta