python – How to authenticate in google colab with minimal permissions?


I’m very new to google.colab, and I created an application that would be used publicly. However, when I do this it asks the user to sign in and give permission for the program to read, edit, delete, modify everything in drive and sheets, which is totally unnecessary. The code just accesses a publicly available google sheet and nothing else.

I have code here:

from google.colab import auth
from google.auth import default
creds, _ = default()
auth.authenticate_user()
gc = gspread.authorize(creds)

Is there a simple way to specify or at least limit the permissions asked ? Or even better, not ask for sign-in at all ?

Thanks!

I’ve tried just converting the sheet to a csv and using that, but the problem with this is that the sheet automatically updates based on external data, so I would rather not change the format from google sheet and lose this automation…



Source link

Leave a Comment