I'm developing an application that manipulates data in Google Cloud Storage buckets owned by the user. I would like to set it up so the user can arrange to grant the application access to only one of his or her buckets, for the sake of compartmentalization of damage if the app somehow runs amok (or it is impersonated by a bad actor or whatever).
But I'm more than a bit confused by the documentation around GCS authorization.
The docs on OAuth 2.0 authentication show that there are only three
choices for scopes: read-only
, read-write
, and full-control
. Does this
mean that what I want is impossible, and if I grant access to read/write one
bucket I'm granting access to read/write all of my buckets?
What is extra confusing to me is that I don't understand how this all plays in with GCS's notion of projects. It seems like I have to create a project to get a client ID for my app, and the N users also have to create N projects for their buckets. But then it doesn't seem to matter -- the client ID from project A can access the buckets from project B. What are project IDs actually for?
So my questions, in summary:
Can I have my installed app request an access token that is good for only a single bucket?
If not, are there any other ways that developers and/or careful users typically limit access?
If I can't do this, it means the access token has serious security implications. But I don't want to have to ask the user to go generate a new one every time they run the app. What is the typical story for caching the token?
What exactly are project IDs for? Are they relevant to authorization in any way?
I apologize for the scatter-brained question; it reflects what appears to be scatter-brained documentation to me. (Or at least documentation that isn't geared toward the installed application use case.)